From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-04-10 17:44:19
From: "Niels Dekker - mail address until 2008-12-31"
Subject: Re: [boost] [optional] problems with swap()
> Thorsten Ottosen wrote:
> What would you think of having boost::optional implemented by holding a
> pointer to T, instead of an aligned_storage object and a m_initialized
> flag? It would manage the memory that the pointer would point to.
> Having NULL would indicate being uninitialized. (I admit it's a rather
> theoretical question, because I don't even know if Fernando would like
> such an approach...)
I don't think that it is a good idea to have a pointer, I expect no extra
allocation from optional.
You can always try to do that in another class, optional_ptr or whatever
name you want for.
I think that this class will be very eassy to implement. Still I will expect
value semantics, and in this
case the extra allocation on copy constructors and assignations will be very
Vicente Juan Botet Escriba
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk