Boost logo

Boost Users :

From: Delfin Rojas (drojas_at_[hidden])
Date: 2006-07-16 18:56:13


> Zhuo Hao wrote:
>
> <snap>
>
> I wonder how it is implemented that we cannot pass zero as a
> pointer to Y in the constructor of shared_ptr.

Consider:

template <class U>
class P
{
public:
    template <class V>
    P(V * v) : u(v) {}

private:
    U *u;
};

Now "P<CMutex> p1(0);" will not compile but "P<CMutex> p1(new CMutex);"
will.

-delfin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net