Boost logo

Boost :

Subject: Re: [boost] std::optional<T>
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-04-22 12:52:11


On Monday 22 April 2013 12:45:58 Fernando Cacciola wrote:
> On 22-Apr-13 12:09 PM, Mathias Gaunard wrote:
> > On 22/04/2013 15:05, Fernando Cacciola wrote:
> >> On 22-Apr-13 9:37 AM, Nathan Crookston wrote:
> >>> Fernando Cacciola wrote:
> >>>> Hi People,
> >>>>
> >>>> I'm pleased to announce that thanks to the outstanding effort of
> >>>> Andrzej
> >>>> Krzemienski who wrote the standard papers, and Ville Voutilainen who
> >>>> champion it during the meetings, we now have std::optional<T> in C++14!
> >>>
> >>> Great news! I'm almost scared to ask, but what did the committee decide
> >>> concerning optional<T&>?
> >>
> >> LOL, I knew people would ask.
> >> Well, they decided to drop it from C++14.
> >
> > That's not what I remember.
> >
> > I thought that what was said is that optional<T&> didn't need to be
> > specialized,
>
> That's technically correct.
>
> So I should have said that our proposed specialization for T& was dropped.

First, congratulations! I'm happy to see this component is making its way into
the standard.

Second, if I understand correctly, without specializing optional for
references, optional<T&> will be suboptimal (i.e. it will essentially be a
pointer and a bool instead of just a pointer). Why not requiring this
optimization?


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