I need (want) to specialize a method inside a template class, to allow only certain primitive types. (This is not a duplicate question of this)
Well i've got this class :
template<typename TYPE, size_t NB>
class X
{
public:
template<typename arg_type>
X& get(const arg_type var);
}
I would like to specialize arg_type to allow only unsigned integers, something like this :
template<typename TYPE, size_t NB> template<unsigned long> X& X::get(const unsigned long val);
But sure, the above doesn't work, neither on msvc2011 nor on gcc
To be more specific, what i try to do is to write a code based on the templated type above, and write the specialization so that anyone using this class X cannot use this method with something else than what i specialized.
Is that even possible ? and if it is, is it bad to do it so ?
Thanks in advance, jav974