Jump to content
  • Advertisement
Sign in to follow this  
FoxMulder900

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

This topic is 3715 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 << 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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!