Reputation: 7136
The code is something like so
void buildIt(Object& o, Tokenizer::const_iterator begin, Tokenizer::const_iterator end){
if(begin == end) return;
else{
string parent = *begin;
bool hasChild = (begin+1) != end; //error: class booost::token_iterator<...> has no member named 'advance'
}
}
How can I check to see if the next iterator is valid without moving it?
Upvotes: 0
Views: 484
Reputation: 59841
You can always just copy the iterator and increment the copy. Or use boost::next
.
if(boost::next(iter) == end)
cout << "...";
Upvotes: 1