Boost logo

Boost :

Subject: Re: [boost] [review] Review of Outcome (starts Fri-19-May)
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-05-16 23:25:39

On 16/05/2017 13:50, Peter Dimov wrote:
>> Surely this must also throw if f1_impl() can produce an error outcome
>> and thus might not contain an X?
> Yes of course, the examples are deliberately identical semantically, one
> uses "void get()" and the other uses "T value()". I prefer the second.

Future uses "T get()". This is established standard.
Smart pointers use "T* get()", which is equivalent to the above. Also
Boost Optional uses "T& get()" (although also provides value(),
presumably for standard compatibility).

Std Optional uses "T value()". This is either still experimental or
approved for C++17; I'm not entirely sure how far along that is.

The different interfaces of the above seem unfortunate (and Std Optional
seems incorrect in this regard to me).

So why not "T get()"? That's much more consistent with other types.

Boost list run by bdawes at, gregod at, cpdaniel at, john at