Instantiate a method template of a class template

Silicomancer

How can I explicitely instantiate method f of the following snippet?

template <int x> class A
{
public:
   template <typename T> inline void f(T y) { y = x; }
};
TartanLlama

Use this syntax:

template void A<0>::f<int>(int);

Obviously substitute 0 and int for what you want to instantiate with.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how to instantiate a template of template class

instantiate a template class with a template parameter of another class

How to instantiate and rename a template class

Template method of template class specialization

Overload template method in template class

Template class with template method id

Template specialization on a non template method in a template class

Explicitly instantiate class through template alias

Instantiate non-template class with templated constructor

how to instantiate T type inside a template class

C++ Not able to instantiate a Template Class

Instantiate an object of template class type in C++

C++ Instantiate Template Variadic Class

Class template method specialization

Template method inside a class

Template method in template class with definition outside class

Template class object as an argument in a template class method

Dynamic template method selection within template class

Calling a template method on a class template parameter

Template class with template method specialized for itself

Clang AST for a template method of a template class

Template class with method depending on template parameter

Get return type of template method in a template class

Correct way to instantiate a class member of template class with paramter

Nested template class method syntax

Calling method of template base class

Add method to class by template parameter

How to instantiate the base class when using the Curiously Recurring Template Pattern?

Instantiate typename object inside class template with any set of parameters