Subject: Re: [boost] [optional] memory use for optional refs and ptrs
From: Fernando Cacciola (fernando.cacciola_at_[hidden])
Date: 2010-10-06 23:36:05
> I think I know what optional models, and it is clearly what I want. However, I
> would like to have space-efficient ones.
Achieving the space-efficiency via specific values is not an option for the
reasons stated before. On the other hand, doing that by some other means is
always worth consideration.
That has also been discussed in the past, but sadly I don't remember any conclusion.
Off the top of my head (and past midnight) I'm thinking that a specialized
version of aligned storage that always allocate one extra byte at the end might
do the trick.
Having said that, there is a problem with your *requirement*. I have had sort of
the opposite: replace the bool with a pointer to T, for debugging purposes
(out-of-the-box pretty printing). The justification being precisely that the
bool takes up the same space anyway. I really liked that change, and I was
planing on doing it. Now I'm not so sure, because your's is also valid (if no
-- --- Fernando Cacciola SciSoft Consulting, Founder http://www.scisoft-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk