This commit is contained in:
Simon Brand
2017-10-01 22:21:53 +01:00
parent c82c8abde2
commit 4fc291ecd5

View File

@@ -343,7 +343,7 @@ namespace tl {
} }
// TODO conditionally disable // TODO conditionally disable
constexpr optional(optional&& rhs) { constexpr optional(optional&& rhs) noexcept(std::is_nothrow_move_constructible<T>::value) {
if (rhs.has_value()) { if (rhs.has_value()) {
this->m_has_value = true; this->m_has_value = true;
new (std::addressof(this->m_value)) T (std::move(*rhs)); new (std::addressof(this->m_value)) T (std::move(*rhs));
@@ -428,7 +428,8 @@ namespace tl {
} }
// TODO conditionally delete, check exception guarantee // TODO conditionally delete, check exception guarantee
optional& operator=(optional&& rhs) noexcept { optional& operator=(optional&& rhs)
noexcept(std::is_nothrow_move_assignable<T>::value && std::is_nothrow_move_constructible<T>::value) {
if (has_value()) { if (has_value()) {
if (rhs.has_value()) { if (rhs.has_value()) {
this->m_value = std::move(rhs.m_value); this->m_value = std::move(rhs.m_value);