Boost logo

Boost :

Subject: Re: [boost] [optional] memory use for optional refs and ptrs
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-10-07 08:33:55


On 2010-10-07 13:36, David Abrahams wrote:
> At Wed, 06 Oct 2010 20:31:30 +0200,
> Rutger ter Borg wrote:
>>
>>> Optional models "the variable is not set." You want something
>>> different. Why not just create a different class to model what you
>>> want?
>>
>> I think I know what optional models, and it is clearly what I want.
>> However, I would like to have space-efficient ones.
>
> It seems clear to me that optional<T*> models one more state than you
> want. You're not interested in "no T*" and "a null T*" as separate
> states.
>

That's right, that would be optional<T&>.

Cheers,

Rutger


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