Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-11-21 10:41:23


From: "David Abrahams" <dave_at_[hidden]>
>
> Wow, such service!!
>
> Well, it needs some help for MSVC. I'll be happy to make those patches
> if neccessary.

Does it? What kind of help? Can you post a test case that fails on MSVC?

'D' in counted_base_impl<P, D> is never cv-qualified and never a reference
type, so I figured that things will work reasonably well. get_deleter<D
const> might not work but you don't need to use that... I think?

> And what about the need for 2-phase check because the
> deleter may have been optimized away? That was your concern.

No, there is no need for a 2-phase check. This

if(has_deleter<D>(p))
{
    D * p = get_deleter<D>(p);
// ...
}

is equivalent to

if(D * p = get_deleter<D>(p))
{
// ...
}

The deleter can only be optimized away completely if shared_ptr hasn't been
constructed with a deleter (in which case get_deleter<X> should return 0 for
any X). Otherwise, the deleter will be there, although it may be an empty
base, if compressed_pair is used. But it still will have an address.


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