28 May
2017
28 May
'17
5:45 p.m.
On Sun, May 28, 2017 at 10:40 AM, Steven Watanabe via Boost
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