|
Boost : |
Subject: Re: [boost] [outcome] On the design and documentation
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-28 23:27:49
>>> - 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/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk