Sign in to follow this  

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

This topic is 3501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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
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

This topic is 3501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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