Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-02-06 10:44:32


    I have a question about smart pointer policies. I feel this is some
missing link in shifted_ptr.

struct shifted_header
        int m_count;
        void * m_owner;


template <typename T>
    struct shifted_object
        shifted_header m_header;
        T m_object;

void * operator new (size_t, shifted_type const &) returns a pointer of type
T, sizeof(shifted_object), member of shifted_object<T>.

$100 Question:
When I am looking at the "Storage Policy", p. 189, Modern C++ Design; the
class must be initialized by a StoredType object while in my situation the
StoredType is a shifted_object<T> and 'new (so) T' returns a pointer to T
(member of shifted_boject<T>). What am I supposed to do if I want to keep
it optimized and simple?


Philippe A. Bouchard

Boost list run by bdawes at, gregod at, cpdaniel at, john at