Here is the code. When
Code:
string line("dd-9c32d00@3");
is changed to
Code:
string line("dd-9c32d00");
The program crashes.
It seems that tok.end() does not bound the end of string parsing?
Code:
#include <boost/tokenizer.hpp>
using namespace std;
using namespace boost;
int main(){
//string line("dd-9c32d00@3");
string line("dd-9c32d00");// crashes!
typedef boost::tokenizer< boost::char_separator<char> > token;
boost::char_separator<char> sep("@");
token tok(line, sep);
token::iterator itt=tok.begin();
if (itt==tok.end())
cout<<*itt;
else
cout<<*(++itt);
return 0;
}