Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++/STL Wankery

Name: Anonymous 2011-02-15 19:11

In C++, can I define a typecast operator for converting (both ways) between std::string and const char *?

In the end, I just want to avoid having to declare every function twice:


   void func1(const char *x) { func1(std::string(x)); }
   void func1(std::string x);

   void func2(const char *x) { func2(std::string(x)); }
   void func2(std::string x);

   void func3(const char *x) { func3(std::string(x)); }
   void func3(std::string x);

Name: Anonymous 2011-02-17 1:19

>>11
Yeah, in C++98, 0 is the null pointer constant, and the NULL macro was deprecated.

Pretty retarded. Thank god C++0x brings us the nullptr keyword.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List