How do I make it so the following code is externalised outside the class:
template<typename TemplateItem>
class TestA
{
operator const int (){return 10;}
};
So it appears like:
template<typename TemplateItem>
class TestA
{
operator const int ();
};
template<>
TestA<int>::operator const int()
{
//etc etc
}
So I can specialise the function for different templated types?
Write this:
The standard antonym of “inline” is usually “out of line”, by the way. Also, I’d probably make the function
const, as one usually does with conversion operators (to allow conversions from constant objects).You can either specialize the entire class, or just the member function. For the member function only, write this:
For the entire class specialization, the syntax is this: