Without using Boost, how can I write a function like:
template<typename T>
void myFunc(T t)
{
...
}
template<>
void myFunc(someclass<T> t)
{
myFunc(t.get());
}
Update: I may have over analyzed this. I was confused when I wanted the original
template<typename T>
void myFunc(T t)
{
...
}
to work with vector. I suppose I got confused because in specializations of template functions you omit the typename argument and I thought I needed the T still.
It appears one of the answers may already work.
Not sure why you associate Boost with this. Anyway:
This won’t work since
Tdoesn’t exist here.What you probably meant is: