Opened 12 years ago

Closed 10 years ago

#4185 closed Bugs (fixed)

VC10 std::shared_ptr not supported?

Reported by: olafvdspek@… Owned by: Peter Dimov
Milestone: To Be Determined Component: bind
Version: Boost 1.43.0 Severity: Problem
Keywords: Cc: viboes

Description

VC10 std::shared_ptr doesn't appear to be supported by boost::bind and requires a manual get_pointer overload.

1>c:\vc\include\boost/bind/mem_fn_template.hpp(156): error C2784: 'T *boost::get_pointer(const std::auto_ptr<_Ty> &)' : could not deduce template argument for 'const std::auto_ptr<_Ty> &' from 'std::tr1::shared_ptr<_Ty>'

Change History (4)

comment:1 by viboes, 10 years ago

Cc: viboes added
Milestone: Boost 1.43.0To Be Determined

Could you post an example showing the error?

comment:2 by Olaf van der Spek <olafvdspek@…>, 10 years ago

1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'T *boost::get_pointer(const boost::scoped_ptr<T> &)' : could not deduce template argument for 'const boost::scoped_ptr<T> &' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\smart_ptr\scoped_ptr.hpp(124) : see declaration of 'boost::get_pointer'
1>          c:\vc\include\boost\bind\mem_fn_template.hpp(171) : see reference to function template instantiation 'R boost::_mfi::mf1<R,T,A1>::call<U,const boost::system::error_code>(U &,const void *,B1 &) const' being compiled
1>          with
1>          [
1>              R=void,
1>              T=connection,
1>              A1=const boost::system::error_code &,
1>              U=std::shared_ptr<connection>,
1>              B1=const boost::system::error_code
1>          ]
1>          c:\vc\include\boost\bind\mem_fn_template.hpp(171) : see reference to function template instantiation 'R boost::_mfi::mf1<R,T,A1>::call<U,const boost::system::error_code>(U &,const void *,B1 &) const' being compiled
1>          with
1>          [
1>              R=void,
1>              T=connection,
1>              A1=const boost::system::error_code &,
1>              U=std::shared_ptr<connection>,
1>              B1=const boost::system::error_code
1>          ]
1>          c:\vc\include\boost\bind\bind.hpp(313) : see reference to function template instantiation 'R boost::_mfi::mf1<R,T,A1>::operator ()<std::shared_ptr<_Ty>>(U &,A1) const' being compiled
1>          with
1>          [
1>              R=void,
1>              T=connection,
1>              A1=const boost::system::error_code &,
1>              _Ty=connection,
1>              U=std::shared_ptr<connection>
1>          ]
1>          c:\vc\include\boost\bind\bind.hpp(313) : see reference to function template instantiation 'R boost::_mfi::mf1<R,T,A1>::operator ()<std::shared_ptr<_Ty>>(U &,A1) const' being compiled
1>          with
1>          [
1>              R=void,
1>              T=connection,
1>              A1=const boost::system::error_code &,
1>              _Ty=connection,
1>              U=std::shared_ptr<connection>
1>          ]
1>          c:\vc\include\boost\bind\bind_template.hpp(102) : see reference to function template instantiation 'void boost::_bi::list2<A1,A2>::operator ()<F,boost::_bi::list2<const boost::system::error_code &,const unsigned int &>>(boost::_bi::type<T>,F &,A &,int)' being compiled
1>          with
1>          [
1>              A1=boost::_bi::value<std::shared_ptr<connection>>,
1>              A2=boost::arg<1>,
1>              F=boost::_mfi::mf1<void,connection,const boost::system::error_code &>,
1>              T=void,
1>              A=boost::_bi::list2<const boost::system::error_code &,const size_t &>
1>          ]
1>          c:\vc\include\boost\bind\bind_template.hpp(102) : see reference to function template instantiation 'void boost::_bi::list2<A1,A2>::operator ()<F,boost::_bi::list2<const boost::system::error_code &,const unsigned int &>>(boost::_bi::type<T>,F &,A &,int)' being compiled
1>          with
1>          [
1>              A1=boost::_bi::value<std::shared_ptr<connection>>,
1>              A2=boost::arg<1>,
1>              F=boost::_mfi::mf1<void,connection,const boost::system::error_code &>,
1>              T=void,
1>              A=boost::_bi::list2<const boost::system::error_code &,const size_t &>
1>          ]
1>          c:\vc\include\boost\asio\detail\handler_type_requirements.hpp(79) : see reference to function template instantiation 'void boost::_bi::bind_t<R,F,L>::operator ()<const Arg1,const Arg2>(const A1 &,const A2 &)' being compiled
1>          with
1>          [
1>              R=void,
1>              F=boost::_mfi::mf1<void,connection,const boost::system::error_code &>,
1>              L=boost::_bi::list2<boost::_bi::value<std::shared_ptr<connection>>,boost::arg<1>>,
1>              Arg1=const boost::system::error_code,
1>              Arg2=const size_t,
1>              A1=const boost::system::error_code,
1>              A2=const size_t
1>          ]
1>          c:\vc\include\boost\asio\impl\read.hpp(274) : see reference to function template instantiation 'void boost::_bi::bind_t<R,F,L>::operator ()<const Arg1,const Arg2>(const A1 &,const A2 &)' being compiled
1>          with
1>          [
1>              R=void,
1>              F=boost::_mfi::mf1<void,connection,const boost::system::error_code &>,
1>              L=boost::_bi::list2<boost::_bi::value<std::shared_ptr<connection>>,boost::arg<1>>,
1>              Arg1=const boost::system::error_code,
1>              Arg2=const size_t,
1>              A1=const boost::system::error_code,
1>              A2=const size_t
1>          ]
1>          c:\vc\xbt\turbo\connection.cpp(64) : see reference to function template instantiation 'void boost::asio::async_read<boost::asio::ip::tcp::socket,boost::asio::mutable_buffers_1,boost::_bi::bind_t<R,F,L>>(AsyncReadStream &,const MutableBufferSequence &,const ReadHandler &)' being compiled
1>          with
1>          [
1>              R=void,
1>              F=boost::_mfi::mf1<void,connection,const boost::system::error_code &>,
1>              L=boost::_bi::list2<boost::_bi::value<std::shared_ptr<connection>>,boost::arg<1>>,
1>              AsyncReadStream=boost::asio::ip::tcp::socket,
1>              MutableBufferSequence=boost::asio::mutable_buffers_1,
1>              ReadHandler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,connection,const boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<std::shared_ptr<connection>>,boost::arg<1>>>
1>          ]
1>          c:\vc\include\boost\smart_ptr\scoped_ptr.hpp(124) : see declaration of 'boost::get_pointer'
1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'T *boost::get_pointer(const boost::intrusive_ptr<T> &)' : could not deduce template argument for 'const boost::intrusive_ptr<T> &' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\smart_ptr\intrusive_ptr.hpp(233) : see declaration of 'boost::get_pointer'
1>          c:\vc\include\boost\smart_ptr\intrusive_ptr.hpp(233) : see declaration of 'boost::get_pointer'
1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'optional<T>::pointer_type boost::get_pointer(boost::optional<T> &)' : could not deduce template argument for 'boost::optional<T> &' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\optional\optional.hpp(741) : see declaration of 'boost::get_pointer'
1>          c:\vc\include\boost\optional\optional.hpp(741) : see declaration of 'boost::get_pointer'
1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'optional<T>::pointer_const_type boost::get_pointer(const boost::optional<T> &)' : could not deduce template argument for 'const boost::optional<T> &' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\optional\optional.hpp(733) : see declaration of 'boost::get_pointer'
1>          c:\vc\include\boost\optional\optional.hpp(733) : see declaration of 'boost::get_pointer'
1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'T *boost::get_pointer(const boost::shared_ptr<X> &)' : could not deduce template argument for 'const boost::shared_ptr<X> &' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\smart_ptr\shared_ptr.hpp(561) : see declaration of 'boost::get_pointer'
1>          c:\vc\include\boost\smart_ptr\shared_ptr.hpp(561) : see declaration of 'boost::get_pointer'
1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'T *boost::get_pointer(const std::auto_ptr<_Ty> &)' : could not deduce template argument for 'const std::auto_ptr<_Ty> &' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\get_pointer.hpp(25) : see declaration of 'boost::get_pointer'
1>          c:\vc\include\boost\get_pointer.hpp(25) : see declaration of 'boost::get_pointer'
1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'T *boost::get_pointer(T *)' : could not deduce template argument for 'T *' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\get_pointer.hpp(18) : see declaration of 'boost::get_pointer'
1>c:\vc\include\boost\bind\mem_fn_template.hpp(156): error C2784: 'T *boost::get_pointer(const boost::reference_wrapper<T> &)' : could not deduce template argument for 'const boost::reference_wrapper<T> &' from 'std::shared_ptr<_Ty>'
1>          with
1>          [
1>              _Ty=connection
1>          ]
1>          c:\vc\include\boost\ref.hpp(182) : see declaration of 'boost::get_pointer'
1>          c:\vc\include\boost\ref.hpp(182) : see declaration of 'boost::get_pointer'

comment:3 by Peter Dimov, 10 years ago

(In [81125]) Add get_pointer overloads for std::unique_ptr, std::shared_ptr. Refs #4185.

comment:4 by Peter Dimov, 10 years ago

Resolution: fixed
Status: newclosed

(In [81329]) Merged [81125] from trunk. Fixes #4185.

Note: See TracTickets for help on using tickets.