Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2002-08-25 10:43:01


I am adding small example to the serialization library which implements serialization for shared_ptr.

smart_ptr includes and instance of shared_count

A very short summary of shared count is:

class counted_base
{
}

template<class P, class D>
class counted_base_imp public counted_base
{
};

class shared_count
{
        counted_base *pi_;
};

template<class T>
class shared_ptr
{
        shared_count pn;
        T * px;
};

It turns out this is not really well suited to my purposes. I'm really interested in knowing something seemingly simpler wasn't used - such as

template<class T>
class shared_count
{
};

template<class T>
class shared_ptr
{
        shared_count<T> pn;
        T *px;
};

I have perused the mail archives but can't seem to find out how shared_count came to be as it is. I could use a separate version for my demo, but it would be very useful to me to know more about the rationale for the current implementation.

Robert Ramey


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