Modify

Ticket #3053 (new Feature Requests)

Opened 5 years ago

Last modified 5 years ago

asio::placeholders not compatible with std::tr1::bind

Reported by: sdrongel@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.38.0 Severity: Cosmetic
Keywords: Cc:

Description

If I use a placeholder from boost::asio::placeholders with std::tr1::bind from <functional>, I get loads of compiler output, concluding with this:

/usr/include/c++/4.3/tr1_impl/functional:1138: error: no match for call to '(std::tr1::_Mem_fn<void (Connection::*)(const boost::system::error_code&)>) (Connection*&, boost::arg<1> (*&)())'
/usr/include/c++/4.3/tr1_impl/functional:551: note: candidates are: _Res std::tr1::_Mem_fn<_Res (_Class::*)(_ArgTypes ...)>::operator()(_Class&, _ArgTypes ...) const [with _Res = void, _Class = Connection, _ArgTypes = const boost::system::error_code&]
/usr/include/c++/4.3/tr1_impl/functional:556: note:                 _Res std::tr1::_Mem_fn<_Res (_Class::*)(_ArgTypes ...)>::operator()(_Class*, _ArgTypes ...) const [with _Res = void, _Class = Connection, _ArgTypes = const boost::system::error_code&]
/usr/include/c++/4.3/tr1_impl/functional:1138: error: return-statement with a value, in function returning 'void'

With Connection a self-defined class. If I use boost::bind instead of std::tr1::bind, it works.

To me, this seems like the placeholders from asio are not usable with bind from TR1. Is there any way to fix this in Boost, perhaps using BOOST_HAS_TR1_BIND in the asio headers?

Attachments

Change History

comment:1 Changed 5 years ago by arvid@…

in my opinion, asio shouldn't have the placeholders in the first place.

Asio supports any binding library/mechanism, and it shouldn't add an unnecessary dependency or preference for any particular one. Granted, once bind is part of std:: it makes more sense, but I think the gain is minimal, and the confusion outweighs it.

comment:2 Changed 5 years ago by chris_kohlhoff

  • Type changed from Bugs to Feature Requests

comment:3 Changed 5 years ago by chris_kohlhoff

  • Milestone changed from Boost 1.40.0 to To Be Determined
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.