|
Boost : |
Subject: Re: [boost] [optional] Specializing optional to save space
From: Jeremy Maitin-Shepard (jeremy_at_[hidden])
Date: 2015-09-28 17:25:25
On Sun, Sep 27, 2015 at 1:03 PM, David Stone <david_at_[hidden]> wrote:
> Andrzej posted another thread about creating a new compact_optional class.
> The goal of this class is to make it easy to create a new optional type
> with a special sentinel value. This allows easy customization per instance
> of an optional value.
>
> This post is about the opposite approach: making it easier to specialize
> optional to provide special behavior for all instances of a given optional
> type.
>
I think this is a great idea; the fact that generic code will get the
optimized version automatically is a strength, not a weakness, of this
approach. It is critical, though, that the behavior is indeed identical in
all respects to the unspecialized version, so that it is a pure
optimization.
It does seem though that much of the benefit from this comes from standard
library integration, which of course won't be available if it is just part
of Boost, so it may be hard to get significant user experience in support
of standardization.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk