Opened 13 years ago

Last modified 13 years ago

#3053 new Feature Requests

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?

Change History (3)

comment:1 by arvid@…, 13 years ago

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 by chris_kohlhoff, 13 years ago

Type: BugsFeature Requests

comment:3 by chris_kohlhoff, 13 years ago

Milestone: Boost 1.40.0To Be Determined
Note: See TracTickets for help on using tickets.