How to explicitly instantiate a template for all members of MPL vector in C++?

后端 未结 6 643
日久生厌
日久生厌 2021-02-01 05:53

Consider the following header file:

// Foo.h
class Foo {
    public: 
        template 
        void read(T& value);
};

I

6条回答
  •  情话喂你
    2021-02-01 06:27

    You can explicitly instantiate Foo for a given T template parameter with template class Foo;

    As for batch instantiation, I don't think it is possible. Maybe with variadic templates it is possible to create an Instantiate class so something like Instantiate would instantiate the appropriate templates, but other than that, you have to resort to manual instantiation.

提交回复
热议问题