Make take always move

Fixes #23
This commit is contained in:
Simon Brand
2019-05-01 09:40:40 +01:00
parent c3752db7e8
commit 53697d4a36

View File

@ -1032,32 +1032,12 @@ public:
#endif
/// Takes the value out of the optional, leaving it empty
optional take() & {
optional ret = *this;
reset();
return ret;
}
optional take() const & {
optional ret = *this;
reset();
return ret;
}
optional take() && {
optional take() {
optional ret = std::move(*this);
reset();
return ret;
}
#ifndef TL_OPTIONAL_NO_CONSTRR
optional take() const && {
optional ret = std::move(*this);
reset();
return ret;
}
#endif
using value_type = T;
/// Constructs an optional that does not contain a value.
@ -1926,32 +1906,12 @@ public:
#endif
/// Takes the value out of the optional, leaving it empty
optional take() & {
optional ret = *this;
reset();
return ret;
}
optional take() const & {
optional ret = *this;
reset();
return ret;
}
optional take() && {
optional take() {
optional ret = std::move(*this);
reset();
return ret;
}
#ifndef TL_OPTIONAL_NO_CONSTRR
optional take() const && {
optional ret = std::move(*this);
reset();
return ret;
}
#endif
using value_type = T &;
/// Constructs an optional that does not contain a value.