Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7798247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:57:00+00:00 2026-06-01T23:57:00+00:00

I had this code building and running perfectly: boost::function<void(string)> bar = boost::bind(&Bar::BarHandler, this, _1);

  • 0

I had this code building and running perfectly:

boost::function<void(string)> bar = boost::bind(&Bar::BarHandler, this, _1);

//Somewhere else in Bar.cpp
void Bar::BarHandler( std::string message ){
    //Do stuff
}

When I happily changed boost by std in the code above, I started getting this error (my compiler is Visual Studio 2010 SP1’s):

c:\program files\microsoft visual studio 10.0\vc\include\xxpmfcaller(42): error C2664: 

'void (std::string)' : cannot convert parameter 1 from 'boost::arg<I>' to 'std::string'
1>          with
1>          [
1>              I=1
1>          ]
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxpmfcaller(52) : see reference to function template instantiation '_Ret std::tr1::_Pmf_caller2<_Ret,_Arg0>::_Call_pmf<_Pmf,_Ty,_Farg1>(volatile const void *,_Pmf,_Farg0 &,_Farg1 &)' being compiled
1>          with
1>          [
1>              _Ret=_Rx,
1>              _Arg0=BarLib::Bar,
1>              _Pmf=void (__thiscall BarLib::Bar::* const )(std::string),
1>              _Ty=BarLib::Bar *,
1>              _Farg1=boost::arg<1>,
1>              _Farg0=BarLib::Bar *
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxcallpmf(9) : see reference to function template instantiation '_Ret std::tr1::_Pmf_caller2<_Ret,_Arg0>::_Apply_pmf<const _Ty,_Arg,boost::arg<I>>(_Pmf,_Farg0 &,_Farg1 &)' being compiled
1>          with
1>          [
1>              _Ret=_Rx,
1>              _Arg0=BarLib::Bar,
1>              _Ty=void (__thiscall BarLib::Bar::* const )(std::string),
1>              _Arg=BarLib::Bar *,
1>              I=1,
1>              _Pmf=void (__thiscall BarLib::Bar::* const )(std::string),
1>              _Farg0=BarLib::Bar *,
1>              _Farg1=boost::arg<1>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxbind1(292) : see reference to function template instantiation '_Ret std::tr1::_Callable_pmf<_Ty,_Memty,_Indirect>::_ApplyX<_Ret,_Arg&,boost::arg<I>&>(_Arg0,_Arg1) const' being compiled
1>          with
1>          [
1>              _Ret=_Rx,
1>              _Ty=void (__thiscall BarLib::Bar::* const )(std::string),
1>              _Memty=BarLib::Bar,
1>              _Indirect=false,
1>              _Arg=BarLib::Bar *,
1>              I=1,
1>              _Arg0=BarLib::Bar *&,
1>              _Arg1=boost::arg<1> &
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxbind0(31) : see reference to function template instantiation '_Ret std::tr1::_Bind2<_Callable,_Arg0,_Arg1>::_ApplyX<_Rx,std::basic_string<_Elem,_Traits,_Ax>&,std::tr1::_Nil&,std::tr1::_Nil&,std::tr1::_Nil&,std::tr1::_Nil&,std::tr1::_Nil&,std::tr1::_Nil&,std::tr1::_Nil&,std::tr1::_Nil&,std::tr1::_Nil&>(_Barg0,_Barg1,_Barg2,_Barg3,_Barg4,_Barg5,_Barg6,_Barg7,_Barg8,_Barg9)' being compiled
1>          with
1>          [
1>              _Ret=_Rx,
1>              _Callable=std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,
1>              _Arg0=BarLib::Bar *,
1>              _Arg1=boost::arg<1>,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Ax=std::allocator<char>,
1>              _Barg0=std::string &,
1>              _Barg1=std::tr1::_Nil &,
1>              _Barg2=std::tr1::_Nil &,
1>              _Barg3=std::tr1::_Nil &,
1>              _Barg4=std::tr1::_Nil &,
1>              _Barg5=std::tr1::_Nil &,
1>              _Barg6=std::tr1::_Nil &,
1>              _Barg7=std::tr1::_Nil &,
1>              _Barg8=std::tr1::_Nil &,
1>              _Barg9=std::tr1::_Nil &
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxcallobj(13) : see reference to function template instantiation 'void std::tr1::_Bind_base<_Ret,_BindN>::operator ()<_Arg0&>(_Carg0)' being compiled
1>          with
1>          [
1>              _Ret=void,
1>              _BindN=std::tr1::_Bind2<std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,BarLib::Bar *,boost::arg<1>>,
1>              _Arg0=std::string,
1>              _Carg0=std::string &
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxfunction(65) : see reference to function template instantiation '_Ret std::tr1::_Callable_obj<_Ty>::_ApplyX<_Rx,_Arg0&>(std::basic_string<_Elem,_Traits,_Ax>)' being compiled
1>          with
1>          [
1>              _Ret=void,
1>              _Ty=std::tr1::_Bind<void,void,std::tr1::_Bind2<std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,BarLib::Bar *,boost::arg<1>>>,
1>              _Rx=void,
1>              _Arg0=std::string,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Ax=std::allocator<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxfunction(64) : while compiling class template member function 'void std::tr1::_Impl_no_alloc1<_Callable,_Rx,_Arg0>::_Do_call(_Arg0)'
1>          with
1>          [
1>              _Callable=_MyWrapper,
1>              _Rx=void,
1>              _Arg0=std::string
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxfunction(386) : see reference to class template instantiation 'std::tr1::_Impl_no_alloc1<_Callable,_Rx,_Arg0>' being compiled
1>          with
1>          [
1>              _Callable=_MyWrapper,
1>              _Rx=void,
1>              _Arg0=std::string
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xxfunction(369) : see reference to function template instantiation 'void std::tr1::_Function_impl1<_Ret,_Arg0>::_Reset0o<_Myimpl,_Fty,std::allocator<_Ty>>(_Fty,_Alloc)' being compiled
1>          with
1>          [
1>              _Ret=void,
1>              _Arg0=std::string,
1>              _Fty=std::tr1::_Bind<void,void,std::tr1::_Bind2<std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,BarLib::Bar *,boost::arg<1>>>,
1>              _Ty=std::tr1::_Function_impl1<void,std::string>,
1>              _Alloc=std::allocator<std::tr1::_Function_impl1<void,std::string>>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\functional(113) : see reference to function template instantiation 'void std::tr1::_Function_impl1<_Ret,_Arg0>::_Reset<_Fx>(_Fty)' being compiled
1>          with
1>          [
1>              _Ret=void,
1>              _Arg0=std::string,
1>              _Fx=std::tr1::_Bind<void,void,std::tr1::_Bind2<std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,BarLib::Bar *,boost::arg<1>>>,
1>              _Fty=std::tr1::_Bind<void,void,std::tr1::_Bind2<std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,BarLib::Bar *,boost::arg<1>>>
1>          ]
1>          d:\svn.dra.workingcopy\acquisition\native\xraygenerator\gemammogenerator.cpp(101) : see reference to function template instantiation 'std::tr1::function<_Fty>::function<std::tr1::_Bind<_Result_type,_Ret,_BindN>>(_Fx)' being compiled
1>          with
1>          [
1>              _Fty=void (std::string),
1>              _Result_type=void,
1>              _Ret=void,
1>              _BindN=std::tr1::_Bind2<std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,BarLib::Bar *,boost::arg<1>>,
1>              _Fx=std::tr1::_Bind<void,void,std::tr1::_Bind2<std::tr1::_Callable_pmf<void (__thiscall BarLib::Bar::* const )(std::string),BarLib::Bar,false>,BarLib::Bar *,boost::arg<1>>>
1>          ]
1>
1>Build FAILED.

What’s going on? Maybe I should remove references to Boost headers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:57:02+00:00Added an answer on June 1, 2026 at 11:57 pm

    you probably need to include <functional> and explicitly use the placeholders namespace for the _1

    using namespace std::placeholders;
    

    Edit: As has been pointed out in comments, you would also need to remove the boost headers that bring in the placeholders into the global namespace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had this code: int foo(void){ return 1; } int main(void){ static const int
I was looking at an authentication system which had this code: # prevents a
I had tested this code: http://support.microsoft.com/kb/316383 It works, but a Word application is opened
Answer solved in edit below I had this piece of code Dictionary<Merchant, int> remaingCards
I was looking at the php.net manual and it had this line of code:
I had this working in an old code that I didn’t end up using...
I used this code in my users views and had no trouble: <% if
I had posted a question in regards to this code. I found that JTextArea
So basically this code was working fine before. I had some computer issues and
I had an exam where I should look at this code and answer the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.