• 12
• 12
• 9
• 10
• 13

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

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

## 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 on other sites
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 on other sites
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!

##### Share on other sites
Quote:
 Original post by FoxMulder900Thanks 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 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 == '/');