Why does `std::string::find()` not return the end iterator on failures?
To begin with, the std::string interface is well known to be bloated and inconsistent, see Herb Sutter’s Gotw84 on this topic. But nevertheless, there is a reasoning behind std::string::find returning an index: std::string::substr. This convenience member function operates on indices, e.g. const std::string src = “https://stackoverflow.com/questions/58430288/abcdefghijk”; std::cout << src.substr(2, 5) << “\n”; You could implement … Read more