64,688
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <boost/tokenizer.hpp>
#include <boost/token_iterator.hpp>
#include <vector>
#include <string>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <cassert>
using boost::tokenizer;
using boost::char_separator;
using boost::keep_empty_tokens;
using std::vector;
using std::wstring;
using std::wcin;
using std::wcout;
using std::istreambuf_iterator;
using std::ostream_iterator;
using std::copy;
int _tmain(int argc, _TCHAR* argv[])
{
istreambuf_iterator<wchar_t> stream_begin(wcin.rdbuf());
istreambuf_iterator<wchar_t> stream_end;
typedef tokenizer<
char_separator<wchar_t>,
istreambuf_iterator<wchar_t>,
wstring> tkz;
char_separator<wchar_t> sep(L",", 0, keep_empty_tokens);
tkz tokens(stream_begin, stream_end, sep);
vector<wstring> str_tokens(tokens.begin(), tokens.end());
copy(str_tokens.begin(), str_tokens.end(), ostream_iterator<wstring, wchar_t>(wcout, L"\n"));
return 0;
}