#pragma once #include template class TMoved { private: mutable T Value; public: TMoved() { } TMoved(const TMoved& that) { DoSwap(Value, that.Value); } TMoved(const T& that) { DoSwap(Value, const_cast(that)); } void swap(TMoved& that) { DoSwap(Value, that.Value); } T& operator*() { return Value; } const T& operator*() const { return Value; } T* operator->() { return &Value; } const T* operator->() const { return &Value; } };