Sign in to follow this  
FoxMulder900

[SOLVED]boost string error - Visual C++ 2008

Recommended Posts

FoxMulder900    122
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[i] << 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]

Share this post


Link to post
Share on other sites
silvermace    634
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"

Share this post


Link to post
Share on other sites
silvermace    634
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.

Share this post


Link to post
Share on other sites
visitor    643
It appears that you might use predicates from the standard <functional> header.

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 == '/');

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this