Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-02-26 10:19:35


Philippe A. Bouchard wrote:

[...]

> void foo(optional<A> const &)
> {
> }
>
> int main()
> {
> optional<B> b;
> optional<C> c;
>
> foo(b);
> //foo(c);
> }

There is a bool (m_initialized) that will prevent the pointer to access
directly the virtual table. It may not be the case if the boolean was
separated from the object, otherwise you will have 2 virtual tables and 1
boolean for one polymorphic object. Forget the type_with_alignment benefits
in this case.

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