Boost logo

Boost :

From: Iain.Hanson_at_[hidden]
Date: 2001-08-03 04:53:47


     t.end ( ) always returns an iterator that is past the end of the
     container and not dereferenceable. This applies to all the standard
     container iterators. Try writting:
     
     for ( tokenizer<>::iterator it = t.begin ( ); it != t.end ( ); ++it )
     {
        string next_token = *it;
     }
     
     /ikh

______________________________ Reply Separator _________________________________
Subject: [boost] tokenazer: last token check
Author: rogeeff (rogeeff_at_[hidden]) at unix,mime
Date: 03/08/01 04:12

Hi!
     
I was hit today by very unfortunate behavior of tokenizer iterator.
Basicly the following 2 lines cause abort:
     
        tokenizer<>::iterator it = t.end();
        it++( or *it);
     
Is it supposed to be that way? If yes - why?
     
if I need somewhere to retreive next token from iterator, I will need
to write something like this:
     
tokenizer<>::iterator it = t.begin();
...
     
if( it == t.end() )
      <not found>
     
if( ++it == t.end() )
      <not found>
     
string next_token = *it;
     
Instead of :
     
string next_token = *(++it);
     
if( next_token is empty string )
    <not found>
     
Gennadiy.
     
     
     
     
Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe_at_yahoogroups.c
om>
     
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
     
     

Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk