Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-06-21 09:04:48


Hello all,

I have a problem with MSVC6 and shared_ptr. The compiler
is hopelessly confused by the template constructor:

template<typename Y> explicit shared_ptr(Y * p)

As a result, it fails to compile:

boost::shared_ptr<int> p(0);

Therefore I suggest the following modification:

#ifdef BOOST_NO_MEMBER_TEMPLATES

explicit shared_ptr(T * p): px(p), pn(p, checked_deleter<T>(), p) // Y must be complete
{
}

#else

template<typename Y>
explicit shared_ptr(Y * p): px(p), pn(p, checked_deleter<Y>(), p) // Y must be complete
{
}

#endif

Comments, anyone?

Markus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk