Just had an interesting argument in the comment to one of my questions. My opponent claims that the statement \"\"
does not contain \"\"<
It's easy. String A contains sub-string B if there is an argument offset
such that A.substr(offset, B.size()) == B
. No special cases for empty strings needed.
So, let's see. std::string("").substr(0,0)
turns out to be std::string("")
. And we can even check your "counter-example". std::string("").substr(0,0).substr(0,0)
is also well-defined and empty. Turtles all the way down.