How can I store objects of differing types in a C++ container?

前端 未结 8 1655
一个人的身影
一个人的身影 2020-11-27 16:26

Is there a C++ container that I could use or build that can contain, say, int and string and double types? The problem I\'m facing is

8条回答
  •  无人及你
    2020-11-27 17:04

    What you want is called a "hetrogenious container". C++ doesn't technically support them in the STL, but Boost does.

    Given that, I think you'll find your answer in this question: how-do-you-make-a-heterogeneous-boostmap

提交回复
热议问题