Is it possible to have something like a global type conversion operator functions for a class? I am specifically looking for a way to expose the const char* from the std::string. I tried defining a global operator but that doesn't compile. With a quick search and looking at the cpp reference these user defined conversion needs to be member http://ift.tt/RgpPeK.
Is there any kind of clean (or hacks) way of passing the std::string to methods that accepts const char* without always using the c_str().
Aucun commentaire:
Enregistrer un commentaire