
AMDG "Peter Dimov" wrote:
Avoiding the ... isn't as trivial as it appears. You might want to try replacing
inline void sp_enable_shared_from_this( shared_count const & /*pn*/, ... ) { }
with
struct sp_any_pointer { template<class T> sp_any_pointer( T* ) {} };
inline void sp_enable_shared_from_this( shared_count const & /*pn*/, sp_any_pointer, sp_any_pointer ) { }
for the _MANAGED case and see if it helps. Also, you can make the return type non-void and use sizeof to avoid calling it.
struct enable_shared_from_this_t { enable_shared_from_this_t operator,(int); }; typedef char no; struct yes { no dummy[2]; }; no test_sp_enable_shared_from_this(enable_shared_from_this_t); template<class T> yes test_sp_enable_shared_from_this( T const &); template<class T, class Y> void sp_enable_shared_from_this( shared_count const & pn, boost::enable_shared_from_this<T> const * pe, Y const * px ) { if(pe != 0) pe->_internal_weak_this._internal_assign(const_cast<Y*>(px), pn); } struct sp_any_pointer { template<class T> sp_any_pointer( T* ) {} }; inline void sp_enable_shared_from_this( shared_count const & /*pn*/, sp_any_pointer, sp_any_pointer ) { } //inline enable_shared_from_this_t sp_enable_shared_from_this( shared_count const & /*pn*/, ... ); template<class T, class Y> void call_sp_enable_shared_from_this_impl( shared_count const & pn, T const * pe, Y const * px, boost::mpl::true_ ) { sp_enable_shared_from_this(pn, pe, px); } template<class T, class Y> void call_sp_enable_shared_from_this_impl( shared_count const &, T const *, Y const *, boost::mpl::false_ ) { } template<class T, class Y> void call_sp_enable_shared_from_this( shared_count const & pn, T const * pe, Y const * px) { boost::mpl::bool_<sizeof( test_sp_enable_shared_from_this((sp_enable_shared_from_this(pn, pe, px),0)) )==sizeof(yes)> condition; call_sp_enable_shared_from_this_impl(pn, pe, px, condition); } In Christ, Steven Watanabe