Boost logo

Boost :

Subject: Re: [boost] [RFC] unique_val (handles, IDs, descriptors...)
From: Nevin Liber (nevin_at_[hidden])
Date: 2018-02-14 21:48:51


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.
   - Instead of providing operator bool(), why not provide operator T&()
   and operator T const&()?
   - What about comparisons of the form: unique_val<T, a> op unique_val<T,
   b>?
   - What about comparisons of the form: unique_val<T> op T (as well as T
   op unique_val<T>)?
   - Propagate noexcept correctly, as it is dependent on the underlying
   operations.
   - Propagate constexpr correctly (for instance, your default constructor
   should be constexpr).

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden] <nevin_at_[hidden]>>
+1-847-691-1404 <(847)%20691-1404>

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