Allow upcast in unique_ref assignment
This commit is contained in:
parent
6442512877
commit
0edf28402c
@ -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<typename U> unique_ref(unique_ref<U>&& 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<typename U> unique_ref& operator=(unique_ref<U>&& from) {
|
||||
_target = std::move(from._target);
|
||||
return *this;
|
||||
}
|
||||
|
||||
typename std::add_lvalue_reference<T>::type operator*() const& {
|
||||
return *_target;
|
||||
|
Loading…
x
Reference in New Issue
Block a user