
On Wed, Mar 5, 2008 at 10:36 AM, Robert Dailey
On Tue, Mar 4, 2008 at 7:16 PM, Marshall Clow
wrote: Would this work? std::for_each( myStrings.begin(), myStrings.end(), boost::bind( &DoFoostd::string, 5, _1 ) );
Well, the example I gave was probably overly simple. The real example uses a boost::python::list, which can either take a char* or a std::string. At the time I'm doing the boost::bind, I do not know what type is being passed in.
Below is the real example: //========================================================================================= bool PyInterpreter::SetSystemPath( std::vectorboost::filesystem::path const& pathList ) { bool success = true; try { using namespace boost::python; list newsyspath; std::for_each( pathList.begin(), pathList.end(), boost::bind( &list::insertboost::filesystem::path, newsyspath, 0, _1 ) ); object sys = GetNamespace( "sys" ); sys["path"] = newsyspath; } catch(...) { PyErr_Print(); success = false; assert( 0 ); } return false; } If you examine my std::for_each() above, you'll notice that I'm simply trying to push 'path' objects into boost::python::list, which won't work but it should at least compile. However the MSVC compiler is telling me that boost::bind expects 2 arguments, not 4. What am I doing wrong?