I am coming up against a vexing conundrum in my code base. I can\'t quite tell why my code generates this error, but (for example) std::string does not.
cla
It is sufficient in this case just to define on operator+:
String operator+(const String& lval, const String& rval);
Because you provide a constructor taking a char*, a String can be constructed from a char* during the call to operator+. For example:
String hello = "Hello, ";
const char* world = "world!";
String helloWorld = hello + world;
A temporary String will be constructed with the contents of the char* world (because your constructor is not explicit), then the two String objects will be passed to operator+.