Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-04-18 23:35:40


"David B. Held" <dheld_at_[hidden]> wrote in message
news:a9ng9b$h31$1_at_main.gmane.org...
> I'm not the Dave you were looking for, but I did Boostify
Loki::SmartPtr
> as much as I could, and have uploaded it to:
> http://groups.yahoo.com/group/boost/files/smart_ptr.hpp

I am greatly indebted. Thank you Dave.

> I stole Select
> right out of TypeManip, and just inserted where appropriate, because
> I am not sure if Boost already has such a facility, or where it is.

I saw it in a couple of places in Boost, in the "detail" namespace. I
think everybody would agree that Select is useful enough to be made a
first-class citizen, and this would be a good occasion to do that.
What header do you gusy think would be most appropriate?

> template <class P, template <class> ThreadingModel>
> class ref_count_mt : public ThreadingModel<ref_count_mt>

That is a bug in Loki. According to the spec of the Ownership policy,
an implementation of that polisy must be a template of one argument.
So the correct setup is:

template <template <class> ThreadingModel>
class ref_count_mt : public ThreadingModel<ref_count_mt>
{
    template <class P> class Impl
    {
        ...
    };
};

Now when someone wants to use a multithreaded reference counted
SmartPtr, they'd instantiate it with
ref_count_mt<MultiThreaded>::Impl.

A nit - you changed the com_ref_counted to call val->add_ref() and
val->release() instead of COM's consecrated val->AddRef() and
val->Release(). I guess things would work slightly better if you left
those two names unchanged :o).

Thanks again, Dave.

Andrei


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