Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-08-21 18:45:11


Philippe A. Bouchard wrote:

>"Philippe A. Bouchard" <philippeb_at_[hidden]> wrote:
>
>
>>"Larry Evans" <jcampbell3_at_[hidden]> wrote:
>>
>>
>>>Larry Evans wrote:
>>>
>>>
>
>[...]
>
>
>
>>>OOPS. It is reset by spOT(spOM), not spOM(spB).
>>>
>>>
>>Checkmate.
>>
>>I see no other alternative but to have:
>>sizeof(ptr_base<T, __true_type>) = sizeof(T *);
>>sizeof(ptr_base<T, __false_type>) = sizeof(ptr_header *) + sizeof(T *);
>>
>>thru placement operator new (size_t, rc_type const &).
>>
>>
>
>It seems 3 specific types of hierarchies have be isolated:
>struct simple_hierarchy {};
>struct complex_hierarchy {};
>struct ambiguous_hierarchy {}.
>
>What about 3 adjacent ptr_base<> types:
>ptr_base<T, simple_hierarchy>;
>ptr_base<T, complex_hierarchy>;
>ptr_base<T, ambiguous_hierarchy>.
>
>Which will have the following properties:
>sizeof(ptr_base<T, simple_hierarchy>) = sizeof(T *);
>sizeof(ptr_base<T, complex_hierarchy>) = sizeof(T *);
>sizeof(ptr_base<T, ambiguous_hierarchy>) = sizeof(int *) + sizeof(T *).
>
>ambiguous_hierarchy could be the default one. Others would be
>optimizations.
>
>
>
Agreed. It would be nice if the compiler could determine which
type of heirarchy :(.

BTW, the object contributing the sizeof(int*) term would just point to
the reference count? Or would it point to both the reference count +
the object, in order to just use one allocation?


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