Leros
Lifer
Another question:
Is it possible to have a template argument that is limited to only a few types?
template<typename A, typename B>
Say I wanted to limit A and B to char, short, and int only. Is there a way to do that without writing 9 specializations?
______________________________________________
I have two template types:
template<typename X, typename Y>
class A {
void foo(B<X,don't care> &bObject> {} //how do I do this?
};
template<typename X, typename Z>
class B {
};
I want to write a function in class A that takes any object of type B as long as the first template argument matches. I don't care if the second argument matches. See the foo function in class A.
How do I do this?
Is it possible to have a template argument that is limited to only a few types?
template<typename A, typename B>
Say I wanted to limit A and B to char, short, and int only. Is there a way to do that without writing 9 specializations?
______________________________________________
I have two template types:
template<typename X, typename Y>
class A {
void foo(B<X,don't care> &bObject> {} //how do I do this?
};
template<typename X, typename Z>
class B {
};
I want to write a function in class A that takes any object of type B as long as the first template argument matches. I don't care if the second argument matches. See the foo function in class A.
How do I do this?
Last edited: