Hey,
I m trying to tokenize a string into its words and found a code example on stackoverflow that puts the string into a stringstream and uses a istream iterator to initialize a vector containing the words. the link: http://stackoverflow.com/questions/53849/how-do-i-tokenize-a-string-in-c
its the 3rd answer. it gets the words into a vector which is what i have to do anyways and i understand the basic principles. i wrote a little funtion looking like this:
Any range is defined by a pair of iterators, begin and past-the-end.
With containers, the past-the-end iterator is provided by the container with the .end()/.cend() member function.
With single-pass input iterators, such as istream_iterator, there is no way to obtain the past-the-end iterator without actually doing the entire pass, and once you do that, you cannot go back (imagine reading a TCP socket)
So instead, every default-constructed istream_iterator serves as the past-the-end iterator for every istream_iterator range (of the same type).