Boost logo

Boost Users :

From: Benjamin Winkler (Benjamin.Winkler_at_[hidden])
Date: 2006-12-09 08:18:56


>I'm having a problem with tokenizer::iterator crashing the program when
>I increment it.
>
>
>tokens.assign(string("1234#4567#1##"), separator("#"));

The tokenizer does not copy the sequence (the string) but only remembers its begin and end iterators. You are constructing a temporary string object which will be destroyed immediately at the end of the line, thus rendering the iterators invalid.
Make sure that the string exists while you are using the tokenizer and its iterators on it, e.g. by making it a class member.

Benjamin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net