Just stumbled upon the following while searching a compile error: There is
JUCE_API String JUCE_CALLTYPE operator+ (String string1, const std::string& string2);
but no
JUCE_API String JUCE_CALLTYPE operator+ (const std:string& string1, const String& string2);
Is there any good reason for that?
I’m guessing, without testing, that doing that might situationally conflict between String, char*, and std::string in either construction or conversion. Then again, it’s fairly easy to solve your issue by constructing a String via the appropriate std::string constructor of String.
Yeah, sure, that’s what I ended up doing – no real big issue, this is mainly my obsession for nice to read code
Tbh. I cannot think of an example where adding this overload would create ambiguities – but I might be overlooking something
Hm, presumably the String unit tests from JUCE itself would show up any issues if you jammed the operator+ into the mix.
1 Like