Hi All,
Following function utilizing boost's string tokenizer class crashes as might be expected:
when line is "::::::::::::::::::::", i.e. made of merely separator characters (":").Code:bool CheckCommand(const string& cmd, const string& line) { if (line.length() == 0) return false; typedef tokenizer< char_separator<char> > StrTokenizer; char_separator<char> sep(":"); StrTokenizer tokens(line, sep); StrTokenizer::iterator it = tokens.begin(); if (*it == cmd) { <<<<--------------- Crash takes place at this line ++it; if (it != tokens.end()) { return true; } } return false; }
How can I checkactually points to something meaningful to prevent this crash ?Code:StrTokenizer::iterator it
Thanks.




Reply With Quote