|
Boost : |
Subject: Re: [boost] [optional] memory use for optional refs and ptrs
From: Ralf W. Grosse-Kunstleve (rwgk_at_[hidden])
Date: 2010-10-05 16:56:50
Rutger ter Borg wrote:
> However, it seems that cases which are usually space-efficient optionals
> (e.g., ptrs in the form of a null-ptr) do not have template specializations.
In case this applies to your use case:
Stores a null pointer if the value is not defined, uses "new" to allocate space
for a value if given. This has been very useful for managing objects that are
rarely needed: the memory overhead is just one pointer for the common case when
the object is not needed.
Ralf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk