Boost logo

Boost :

Subject: Re: [boost] [RFC] unique_val (handles, IDs, descriptors...)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-02-14 22:03:28


AMDG

On 02/14/2018 02:48 PM, Nevin Liber via Boost wrote:
> On Wed, Feb 14, 2018 at 3:18 PM, Miguel Ojeda via Boost <
> boost_at_[hidden]> wrote:
>
>> https://github.com/ojeda/unique_val
>
>
> IMO, such a class is definitely useful.
>
> Design concerns:
>
> - unique_val should be copyable if T is copyable. Whether or not a type
> which aggregates this is copyable is an orthogonal, separate concern from
> what the moved-from state should be. If you go this route, unique_val is
> the wrong name.

  That completely subverts the point of using unique_val
in the first place, which is that you have some cleanup
operation that needs to be applied exactly once, when
your done with the object. This is most common when dealing
with C API's where everything is copyable.

In Christ,
Steven Watanabe


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