Exposing certain instantiations of a templated function

B

Bogdan

I have the following templated function:

template<class T>
My_Class<T> my_function(T in)
{
My_Class<T> obj;
//...
return obj;
}

I would like to expose through the header only certain instantiations
of this templated function instead of the full templated function
signature. Note that this function has also a return parameter which
depends on the template type. Is there a way to achieve this ?
 
Ö

Öö Tiib

I have the following templated function:

template<class T>
My_Class<T> my_function(T in)
{
     My_Class<T> obj;
     //...
     return obj;

}

I would like to expose through the header only certain instantiations
of this templated function instead of the full templated function
signature. Note that this function has also a return parameter which
depends on the template type. Is there a way to achieve this ?

Expose normal function overloads in interface.
Implement them by calling that (unexposed) template.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top