How do I force a particular instance of a C++ template to instantiate?

后端 未结 6 593
误落风尘
误落风尘 2020-11-29 23:07

See title. I have a template. I want to force a particular instance of a template to instantiate. How do I do this?

More specifically, can you force an abstract temp

6条回答
  •  独厮守ぢ
    2020-11-29 23:29

    I'm going to answer what I think you meant, not what you said.

    I am guessing the issue is one of two things. The first is that you have code in a template that's not getting compiled when you compile the template file itself, which can be very annoying. That can be fixed in your compiler settings.

    The other is you want to have something special for a particular type, perhaps to debug it. That is called explicit instanciation but does not really instanciate anything just makes sure it's always defined after that point.

    http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/topic/com.ibm.vacpp6m.doc/language/ref/clrc16explicit_instantiation.htm

提交回复
热议问题