- For the end point of the string:
Assume the internal character string is null-terminated. Then through dereferencing the iterator to see if they're '\0' to determine the next position is end point. But for other non null-terminated string, it's impossible to get to know such information.
- For the start point of the string:
No way to do such thing.
The default std::string::iterator is just a random, bi-direction iterator, doesn't know anything about container.
But if you're working on Visual C++ platform, maybe you can use some hacking way like following to get the control to its container, but it's very dangerous:
// it is the passed in string::iterator parameter.
if (it._Has_container()) {
string* strRef = (string*)it._Mycont;
}