I'm having some trouble getting Boost Xpressive to work as I expect. I'm trying to split a line of text into fields delimited by tab characters:
wstring ws = L"Field1\tField2\tField3";
wsregex_token_iterator fieldIt(ws.begin(), ws.end(), as_xpr(L'\t'), -1);
wsregex_token_iterator endIt;
So far, so good; the above works fine. The problem comes when I try to initialize a vector using the range form of the constructor:
vector<wstring> fields(fieldIt, endIt);
The compiler complains:
cannot convert parameter 1 from 'boost::xpressive::wsregex_token_iterator' to 'unsigned int'
It appears that the compiler assumes that I'm trying to use the vector(size_type n, const T& t)
form of the constructor rather than the template <class InputIterator>
vector(InputIterator, InputIterator)
form. I just can't figure out how to tell it otherwise. Any ideas?
oh: I'm using boost 1.34.1. And Visual Studio.net 2005.