diff --git a/pointer/unique_ref.h b/pointer/unique_ref.h index ef08bdb2..43501dc5 100644 --- a/pointer/unique_ref.h +++ b/pointer/unique_ref.h @@ -28,13 +28,18 @@ class unique_ref final { public: unique_ref(unique_ref&& from): _target(std::move(from._target)) {} - // TODO Test this dynamic-cast-allowing move constructor + // TODO Test this upcast-allowing move constructor template unique_ref(unique_ref&& from): _target(std::move(from._target)) {} unique_ref& operator=(unique_ref&& from) { _target = std::move(from._target); return *this; } + // TODO Test this upcast-allowing assignment + template unique_ref& operator=(unique_ref&& from) { + _target = std::move(from._target); + return *this; + } typename std::add_lvalue_reference::type operator*() const& { return *_target;