From: Carlos Delgado (C.Delgado++at++pgr.salford.ac.uk)
Date: 07/23/2003 04:43:12
Hi there,
I am using STL and it compiles alright but it is doing something bizarre!
The same piece of code (tokenize) in one object, turns alright.
But when using that code (and with the same conditions) on another piece of
code it just crashes.
The piece of code is ( I have tried other form to tokenize it) but when
I call method
of string it just crashes) I tried to create a string with the expected
format but the problem is still the same.
...
void clveCreature::_tokenize (std::vector<std::string>& tokens, const
std::string& str, const char cDelimiter) {
std::string::size_type lastPos = str.find_first_not_of(cDelimiter,
0);
// Find first "non-delimiter".
std::string::size_type pos = str.find_first_of(cDelimiter,
lastPos);
while (std::string::npos != pos || std::string::npos != lastPos)
{
// Found a token, add it to the vector.
tokens.push_back(str.substr(lastPos, pos - lastPos));
// Skip delimiters. Note the "not_of"
lastPos = str.find_first_not_of(cDelimiter, pos);
// Find next "non-delimiter"
pos = str.find_first_of(cDelimiter, lastPos);
}
}
The error from the debugger is.
std::num_put<char,std::ostreambuf_iterator<char,std::char_traits<char> >>::do_put(std::ostreambuf_iterator<char,std::char_traits<char>>,std::ios_base&,char,bool) const(0x100b88a8, 0x100bb010, 0x0, 0x8a7f648, 0x20, 0x1, 0x1000000, 0x0) ["/comp88/mtibuild/v7312m/workarea/v7.3.1.2m/libC/include/stl_numeric_facets.h":973, 0x8a42970]
1
std::num_put<char,std::ostreambuf_iterator<char,std::char_traits<char> >>::put(std::ostreambuf_iterator<char,std::char_traits<char> >,std::ios_base&,char,bool) const(this = 0x100b88a8, __s = (...), __f = 0x8a7f648, __fill = ' ', __val = '\001') ["/usr/include/CC/stl_numeric_facets.h":916, 0x1005c9d8]
2 std::basic_ostream<char,std::char_traits<char>>::_M_put_num(bool)(this = 0x8a7f640, __x = '\001') ["/usr/include/CC/ostream":384, 0x1005c4d4]
3 std::basic_ostream<char,std::char_traits<char>>::operator<<(bool)(this = 0x8a7f640, __x = '\001') ["/usr/include/CC/ostream":60, 0x1005c240]
4 clveCreature::update(float)(this = 0x101284d8, fT = 0.0)
["/server/PHD_STUDENTS/HOME/carlos/phd/code/virtual/ObjectHierarchy.cc":1235,
0x1005aa28]
5 clveCreatureController::update(float)(this = 0x100b9538, fT = 0.0)
["/server/PHD_STUDENTS/HOME/carlos/phd/code/virtual/clCreatureController.cc":80,
0x100434f4]
6 clveWorld::run(void)(this = 0x100b67e8)
["/server/PHD_STUDENTS/HOME/carlos/phd/code/virtual/clWorld.cc":682,
0x1003b73c]
7 ::main(argc = 2, argv = 0x7fff2ed4)
["/server/PHD_STUDENTS/HOME/carlos/phd/code/virtual/Agent007.cc":83,
0x1001beb4]
8 __start()
["/xlv55/kudzu-apr12/work/irix/lib/libc/libc_n32_M4/csu/crt1text.s":177,
0x1001b848]
-- Carlos Delgado ~~~~~ Centre for Virtual Environments (\o o/) The University of Salford ___________ &!& _______________ Business House M5 4WT, U.K. &"Inspiration exists, but it has & (44) +161 295 2918 & to find us working" --Picasso & Fax (44) + 161 285 2925 ________________________________ web http://www.nicve.salford.ac.uk/carlos
This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 04:33:36 PDT