[prev in list] [next in list] [prev in thread] [next in thread]
List: boost
Subject: Re: [boost] [optional] Specializing optional to save space
From: David Stone <david () doublewise ! net>
Date: 2015-09-28 23:29:51
Message-ID: CAPDh5wYuKixR9bj=Jguk==TgQp-qcA3KOBd6JBhcP24G9QQm7A () mail ! gmail ! com
[Download RAW message or body]
On Mon, Sep 28, 2015 at 4:02 PM, Sam Kellett <samkellett@gmail.com> wrote:
> > this applies to any possible value of int -- so therefore somebody,
> > somewhere will have a valid int that is an optional and some purely
> genetic
> > code will get it wrong
> >
>
> er.. generic.. doh
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
This is more in line with the compact_optional proposal in the other
thread. The specialization is only created for a value that cannot
otherwise exist for your type. Any magic value of int is a valid int value,
so there would not be a specialization of optional<int> that makes, say, -1
invalid. In this proposal, there is absolutely nothing the user can do
other than sizeof that lets them tell the difference (and they won't run
out of memory as quickly from allocating a bunch of them).
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic