I am trying to break a string using the method found in this thread , but I am trying to adapt it to wstring. However, I came across a strange mistake. Check the code:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
int main(void)
{
wstring str(L"Börk börk");
wistringstream iss(str);
vector<wstring> tokens;
copy(istream_iterator<wstring>(iss),
istream_iterator<wstring>(),
back_inserter< vector<wstring> >(tokens));
return 0;
}
The exact error message is:
error: no matching function for call to 'std::istream_iterator<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, char, std::char_traits<char>, int>::istream_iterator(std::wistringstream&)'
I think he says that he cannot create an istream_iterator instance using the passed one iss(which is w istringstream instead of istringstream). This is on a Mac using Xcode and GCC 4.2. And AFAIK does not exist wistring_iterator or something like that.
, non-wstring. , wstring, wistringstream vector<wstring>, , .
wstring?