[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost
Subject:    Re: [boost] [outcome] On the design and documentation
From:       Niall Douglas via Boost <boost () lists ! boost ! org>
Date:       2017-05-28 23:27:49
Message-ID: 1d198739-d896-b6e8-6d45-12d5419c3d89 () nedprod ! com
[Download RAW message or body]

>>> - 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_); }
>     };

Meh, .release() makes me think of smart pointers. Though
afio::file_handle does have a .release() to detach the native handle.
I'll ponder it.

Niall

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


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic