The above won't work because "hello" is a c-string and not a std::string reference.Code:void test (std::string& test) { ; } // this won't work test ("hello"); // this will, but is it ugly? test (String ("hello"));
So, I have a number of functions like the above that try to speed up std::string handling by taking references... however... now I need to overload all my functions so that they can handle std::strings and c-strings separately.
Is there any way to be able to handle std::strings and c-strings efficiently without creating tonnes of overloaded functions? Do I just need to make up my mind and not support both everywhere?




Reply With Quote