runtime determine type for C++

后端 未结 3 975
攒了一身酷
攒了一身酷 2020-12-19 11:18

I am wondering if type can be determined as runtime information in C++.

(1) Although my question is quite general, for simplicity, I will start from a simple exampl

3条回答
  •  别那么骄傲
    2020-12-19 11:39

    You need a class that's capable of storing a value of different types. Short from a union, Boost's variant class would be the proper choice.

提交回复
热议问题