Hi!
The following version incorrectly produces the result:
< > 1
//----------------------
#include<iostream>
#include
#include
#pragma hdrstop
#pragma argsused
int main(int argc, char* argv[])
{
using namespace std;
using namespace boost;
AnsiString As = "*";
typedef tokenizer Tok;
char_separator<char> sep(", ");
Tok tokens(string(As.c_str(),As.Length()), sep);
for(Tok::iterator tok_iter = tokens.begin();tok_iter != tokens.end();
++tok_iter)
cout << "<" << *tok_iter << "> " << (*tok_iter).size();
return EXIT_SUCCESS;
}
//----------------------
However, this version correctly outputs this result:
<*> 1
#include<iostream>
#include
#include
#pragma hdrstop
#pragma argsused
int main(int argc, char* argv[])
{
using namespace std;
using namespace boost;
AnsiString As = "*";
string str=string(As.c_str(),As.Length());
typedef tokenizer Tok;
char_separator<char> sep(", ");
Tok tokens(str, sep);
for(Tok::iterator tok_iter = tokens.begin();tok_iter != tokens.end();
++tok_iter)
cout << "<" << *tok_iter << "> " << (*tok_iter).size();
return EXIT_SUCCESS;
}
//----------------------
Why the firt version mulfunctions?
TIA and Regards,
CN
--
http://www.fastmail.fm - A fast, anti-spam email service.