Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-08-21 16:19:02


"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.

Philippe A. Bouchard


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