Why isn’t there a std::basic_string<...>::back() member function?
The functionality is obviously there, I mean, one can write
-
myString[myString.size()-1] -
*myString.rbegin()
Am I assuming some wrong equivalence between the potential back() and the two methods above? You can say that my second version is concise enough, but then, why not provide a function which is trivial to implement which brings string one step closer to a container? Is there a caveat I am missing?
Thanks.
There is no particular reason that
std::stringshouldn’t have had these functions and this assertion is supported by the fact that they have been added in the upcoming C++ standard.