Boost logo

Boost Users :

Subject: [Boost-users] RunTime error + lexical_cast + string with space
From: Uthpal Urubail (uthpal.urubail_at_[hidden])
Date: 2011-12-05 07:20:59


All,
I noticed the below crashes[run time error because of space in string]
Is there a possibility to handle this situation? [without explicitly
calling split]
  
   string s = " 12252001";
   int offsets[] = {5,2,4};
   offset_separator f(offsets, offsets+3);
   tokenizer<offset_separator> tok(s,f);
   for(tokenizer<offset_separator>::iterator beg=tok.begin();
beg!=tok.end();++beg)
           int val = boost::lexical_cast<int>( *beg);

Thanks
UJ


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