Boost logo

Boost :

Subject: Re: [boost] [outcome] On the design and documentation
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2017-05-28 17:45:00


On Sun, May 28, 2017 at 10:40 AM, Steven Watanabe via Boost
<boost_at_[hidden]> wrote:
>> 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 have a class with similar behavior, I named the function which
returns the value destructively T::release() to make it clear at call
sites.

Example:

    template<class T>
    class Holder
    {
     T t_;
    public:
     T release() { return std::move(t_); }
    };

Thanks


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