boost tokenizer problem with stringstream
Hi, A colleague has recently discovered a problem using tokenizerwith the output from a std::stringstream class in VC8. If we dothe following, we get an "ITERATOR LIST CORRUPTED" exceptionthrown: typedef boost::char_separator<char> Separators;typedef boost::tokenizer<Separators > Tokens; std::string str1("ABC");std::string str2("DEF");std::stringstream oss;oss << str1 << "," << str2; Tokens strList(oss.str(), Separators(",|"));Tokens::const_iterator strIter = strList.begin(); // exception thrown here I thought this might be because the string returned from oss.str() is temporaryso I tried the following change and it still failed: std::string tempStr(oss.str());Tokens strList(tempStr, Separators(",|"));Tokens::const_iterator strIter = strList.begin(); // exception thrown here Finally I tried this and it succeeded. std::string tempStr;oss >> tempStr;Tokens strList(tempStr, Separators(",|"));Tokens::const_iterator strIter = strList.begin(); // exception thrown here Can anyone tell me why the first two (in particular the second option) failed? RegardsDaryl Lilburn _________________________________________________________________ Are you paid what you're worth? Find out: SEEK Salary Centre http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2Fcareer%2Dresources%2Fsalary%2Dcentre%2F%3Ftracking%3Dsk%3Ahet%3Asc%3Anine%3A0%3Ahot%3Atext&_t=764565661&_r=OCT07_endtext_salary&_m=EXT
AMDG Daryl Lilburn wrote:
A colleague has recently discovered a problem using tokenizer with the output from a std::stringstream class in VC8. If we do the following, we get an "ITERATOR LIST CORRUPTED" exception thrown:
I can't reproduce this. The following works with vc8 using
1.33.1, 1.34.1, 1.35, and 1.36. If I pass oss.str directly to
the constructor of strList, I get, _DEBUG_ERROR("string iterators
incompatible");
#include
participants (2)
-
Daryl Lilburn
-
Steven Watanabe