boost tokenizer
{
using namespace boost;
typedef std::basic_string<TCHAR> tchar_string;
tchar_string string_cmdline = GetCommandLine();
// typedef boost::tokenizer<boost::char_separator<TCHAR>,
// tchar_string::const_iterator,tchar_string > tokenizer;
typedef boost::tokenizer<boost::escaped_list_separator<TCHAR>,
tchar_string::const_iterator,tchar_string > tokenizer;
boost::escaped_list_separator<TCHAR> sep( _T('`'), _T(' '), _T('\"'));
tokenizer tokens(string_cmdline, sep);
tokenizer::iterator tok_iter = tokens.begin(); //error
for (tok_iter = tokens.begin();
tok_iter != tokens.end();
++tok_iter)
{
std::cout<< *tok_iter <<std::endl;
}
}
{
using namespace boost;
typedef std::basic_string<TCHAR> tchar_string;
tchar_string string_cmdline = GetCommandLine();
// typedef boost::tokenizer<boost::char_separator<TCHAR>,
// tchar_string::const_iterator,tchar_string > tokenizer;
typedef boost::tokenizer<boost::escaped_list_separator<TCHAR>,
tchar_string::const_iterator,tchar_string > mytokenizer;
boost::escaped_list_separator<TCHAR> sep( _T('`'), _T(' '), _T('\"'));
mytokenizer tokens(string_cmdline, sep);
mytokenizer::iterator tok_iter = tokens.begin(); //OK
for (tok_iter = tokens.begin();
tok_iter != tokens.end();
++tok_iter)
{
std::cout<< *tok_iter <<std::endl;
}
}
using namespace boost;
typedef std::basic_string<TCHAR> tchar_string;
tchar_string string_cmdline = GetCommandLine();
// typedef boost::tokenizer<boost::char_separator<TCHAR>,
// tchar_string::const_iterator,tchar_string > tokenizer;
typedef boost::tokenizer<boost::escaped_list_separator<TCHAR>,
tchar_string::const_iterator,tchar_string > tokenizer;
boost::escaped_list_separator<TCHAR> sep( _T('`'), _T(' '), _T('\"'));
tokenizer tokens(string_cmdline, sep);
tokenizer::iterator tok_iter = tokens.begin(); //error
for (tok_iter = tokens.begin();
tok_iter != tokens.end();
++tok_iter)
{
std::cout<< *tok_iter <<std::endl;
}
}
{
using namespace boost;
typedef std::basic_string<TCHAR> tchar_string;
tchar_string string_cmdline = GetCommandLine();
// typedef boost::tokenizer<boost::char_separator<TCHAR>,
// tchar_string::const_iterator,tchar_string > tokenizer;
typedef boost::tokenizer<boost::escaped_list_separator<TCHAR>,
tchar_string::const_iterator,tchar_string > mytokenizer;
boost::escaped_list_separator<TCHAR> sep( _T('`'), _T(' '), _T('\"'));
mytokenizer tokens(string_cmdline, sep);
mytokenizer::iterator tok_iter = tokens.begin(); //OK
for (tok_iter = tokens.begin();
tok_iter != tokens.end();
++tok_iter)
{
std::cout<< *tok_iter <<std::endl;
}
}
0 Comments:
Post a Comment
<< Home