[bind][make_shared] compilation failure with ref arg

The last statement below fails to compile with boost 1.39.0 on MSVC 8.
Am I doing anything obviously wrong? Any help is appreciated.
Jeff
#include

Jeff Flinn wrote:
The last statement below fails to compile with boost 1.39.0 on MSVC 8. Am I doing anything obviously wrong? Any help is appreciated.
...
boost::bind(&boost::make_shared
, boost::ref(i));
Under C++03 compilers, make_shared takes its arguments by const reference:
template

Peter Dimov wrote:
Jeff Flinn wrote:
The last statement below fails to compile with boost 1.39.0 on MSVC 8. Am I doing anything obviously wrong? Any help is appreciated.
...
boost::bind(&boost::make_shared
, boost::ref(i)); Under C++03 compilers, make_shared takes its arguments by const reference:
template
shared_ptr<T> make_shared( A1 const & a1 ); MSVC doesn't like the A1=int& case because it forms the questionably valid "int& const&".
boost::bind( &boost::make_shared
, boost::ref(i) ); works though. This is what make_shared<Y>( ref(i) ) would instantiate.
Ah, thanks Peter! Jeff
participants (2)
-
Jeff Flinn
-
Peter Dimov