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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top