M
m0shbear
Suppose I have the following classes: S T U, each of which is
incompatible with the others.
I want to have functions (ideally written) like this:
template<> T foo<0>(const S&);
template<> U foo<1>(const S&);
Will the template declaration
template<int IType> auto foo(const S&);
work?
Likewise for
template<int IType, class Ret> Ret foo(const S&);
The problem I see with the second one is that the expression
void bar() {
S s;
U u = foo<1>(s); // *
}
will be ill-formed.
Is such a notation for template foo<int>(const S&) even possible?
incompatible with the others.
I want to have functions (ideally written) like this:
template<> T foo<0>(const S&);
template<> U foo<1>(const S&);
Will the template declaration
template<int IType> auto foo(const S&);
work?
Likewise for
template<int IType, class Ret> Ret foo(const S&);
The problem I see with the second one is that the expression
void bar() {
S s;
U u = foo<1>(s); // *
}
will be ill-formed.
Is such a notation for template foo<int>(const S&) even possible?