I have a proxy container class around a movable object, and wish the proxy to be able to implicitly yield an rvalue reference to the underlying object, but only when the proxy itself is being moved.
I believe that I will be able to implement this behaviour as per proposal n2439 "Extending move semantics to *this", but it is not yet available in a release of gcc and won't be for a while.
The code below is what I am ultimately aiming for, but is not currently possible. Until this feature is available to me, are there any equivalent workarounds?
template< class T >
struct movable_proxy {
operator T&&() && {
return std::move(value);
}
operator const T&() const& {
return value;
}
private:
T value;
};