From 0edf28402cddb39d5b292a69f503f265bf7bce7b Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sun, 28 Jun 2015 17:40:16 +0200 Subject: [PATCH] Allow upcast in unique_ref assignment --- pointer/unique_ref.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;