Opened 13 years ago

Closed 13 years ago

#4077 closed Bugs (invalid)

for-loop condition operator < does not work

Reported by: Elmar Teitge <elmar.teitge@…> Owned by: jsiek
Milestone: Boost 1.43.0 Component: tokenizer
Version: Boost 1.42.0 Severity: Problem
Keywords: tokenizer loop condition Cc:

Description

I have tried to use tokenizer in my prefered form with the less than operator in the loop condition.

looks like this:

for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter < tokens.end(); tok_iter ++)

vInVector.push_back( *tok_iter );

I got an compiler error on visual studio 7.1 with the details of iterator_facade implementation. I think, this code example is valid and this bug should be fixed.

Change History (1)

comment:1 by Sebastian Redl, 13 years ago

Resolution: invalid
Status: newclosed

Tokenizer's iterators are not random access iterators, therefore < does not work. Use !=, which is idiomatic for iterator loops.

Note: See TracTickets for help on using tickets.