I have a template function that works for 99% of the cases and want a different one for the 1%. The problem is that the template case is too "vague" and thus the compiler tries to use it for everything.
Code:template <typename T> T get(T a) { ... } //The one case I want diff. std::string get(SomeClass a) { ... } int main() { std::string name( "Jeff" ); //This is correct std::string val = get( name ); SomeClass a; //Won't compile, says: //cannot convert 'SomeClass' to 'std::string' in initialization std::string val = get( a ); }



LinkBack URL
About LinkBacks



