[SOLVED]boost string error - Visual C++ 2008
Hello,
I have patched and compiled boost for Visual Studio 2008 express and everything seemed to compile correctly.
However, I wrote a simple test application to see how the boost features I want to use work. I am trying to use the string split method but I am getting the following error:
C:\Boost\include\boost-1_34_1\boost/algorithm/string/detail/finder.hpp(581) : error C2064: term does not evaluate to a function taking 1 arguments
Here is my code:
string test = "24/3/14";
vector<string> vect;
boost::split(vect, test, '/');
for(int i=0; i< vect.size(); i++)
{
cout << vect << endl;
}
I am experienced with C++ however this is my first time using boost!
any ideas on what is going wrong would be much appreciated!
[Edited by - FoxMulder900 on May 14, 2008 10:35:05 PM]
try this: boost::split( vect, test, boost::is_any_of("/") );
also, RTM, and again?
It's really unfortunate that most of the boost examples are (as a friend put it) "to launch the space shuttle"
also, RTM, and again?
It's really unfortunate that most of the boost examples are (as a friend put it) "to launch the space shuttle"
Thanks for your help, I didn't realize the is_any_of() function needed to be used even when I am only using one character!
Quote:Original post by FoxMulder900
Thanks for your help, I didn't realize the is_any_of() function needed to be used even when I am only using one character!
yea, boost can be annoying like that.
It appears that you might use predicates from the standard <functional> header.
For example:
Alternatively, boost::lambda also might work:
For example:
boost::split(v, s, std::bind2nd(std::equal_to<char>(), '/'));
Alternatively, boost::lambda also might work:
boost::split(v, s, boost::lambda::_1 == '/');
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement