
--- At Tue, 29 Apr 2003 10:56:03 +0000, John Harris wrote:
--- At Fri, 25 Apr 2003 17:01:56 -0400, Vincent LaBella wrote:
sequence, so I tried <snip> last = tok.begin(); advance(last,tok.size()-1); // error size() not defined. <snip> Implementation left as an excercise. (Is there a standard algorithm
--- In Boost-Users@yahoogroups.com, "Duane Murphy"
wrote: that might fit well besides for_each()?)
how about: std::advance(first, std::distance(first,last)-1) ?
The only requirement for distance() is that iterators be input iterators, which tokenizer's are.
This is an interesting solution. The downside is that the iterator would get advanced twice. I believe the implementation for distance for a forward iterator is to walk the iterator and count the distance. Then advance is going to do the same. This is efficient to type, but inefficient to run. ...Duane