Vector that can have 3 different data types C++

后端 未结 4 1374
你的背包
你的背包 2020-11-29 10:10

I\'m trying to make a vector in C++ that can store 3 different data types. I do not want to use the boost library. Something like:

vector

        
4条回答
  •  时光说笑
    2020-11-29 10:53

    Does it have to be a vector? You might just consider a linked list of generic type, then iterate through that list, use typeid() to figure out the data type of the node and pull the data with a node.get() function.

提交回复
热议问题