-
example for boost:regex_splitWhatAGreatTutorial! 2010. 5. 10. 20:01반응형
Hi,
There's a well-documented piece of behavior in the boost Regex library
(wonderful piece of work, BTW) that regex_split 'eats' the passed in
string, i.e., if you do:#include <fstream>
#include <iostream>
#include <locale>
#include <memory>
#include <boost/regex.hpp>
#include <iterator>
#include <sstream>
#include <vector>
#include <boost/bind.hpp>
std::deque<std::string> tokens;
you'll get:
string MyString = "A B C D";
boost::regex_split(std::back_inserter(tokens),MyString,
boost::regex(" "));
for (std::deque<std::string>::iterator it = tokens.begin(),
end = tokens.end(); it != end; ++it) {
std::cout << *it << endl;
}
cout << endl;
cout << MyString << endl;
A
B
C
D
<blank line>
<blank line>반응형'WhatAGreatTutorial!' 카테고리의 다른 글
community for mac user (0) 2010.05.17 site study for XML (0) 2010.05.13 Linux shell command tips. (0) 2010.04.22 Encoding options for H.264 video (0) 2010.04.02 Migrating from DirectShow to Media Foundation (0) 2009.12.31