Boost logo

Boost :

Subject: Re: [boost] [outcome] On the design and documentation
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-26 13:43:57


>> Why do you prefer get? what do you get with get? How will you name the
>> function that give you access to the value of a PossiblyValued type?
>
> It's really just a different color. The preference to get is coming from
> my mental model of mine with expected being more like a asynchronous
> return object (future calls it get as well). There are other types (with
> similar purpose) using the name get for their accessor: shared_ptr,
> unique_ptr, tuple and variant.

Everyone else hated this idea, but what do you think of:

- T& .value() returns a reference to the value, non-destructive.

- T .get() returns the value by value, destructive.

I personally like this plan, but no one agrees with me. I do agree that
the availability of copy construction muddies clarity of usage very
significantly - a separate move only type implementing .get()
destructively from one implementing .value() non-destructively looks
much cleaner.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

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