Choose template based on run-time string in C++

后端 未结 6 733
终归单人心
终归单人心 2020-12-14 11:39

I have an attribute vector that can hold different types:

class base_attribute_vector; // no template args

template
class raw_attribute_ve         


        
6条回答
  •  不知归路
    2020-12-14 12:31

    You cannot do this. At best, you need to support a limited number of types, and switch between them using an if statement that can be evaluated at compile time.

提交回复
热议问题