Commit a83feea0 authored by Matthias Vallentin's avatar Matthias Vallentin

Mark optional<T>'s move ctor/assignment noexcept

parent f08bb338
......@@ -59,7 +59,9 @@ class optional {
}
}
optional(optional&& other) : m_valid(false) {
optional(optional&& other)
noexcept(std::is_nothrow_move_constructible<T>::value)
: m_valid(false) {
if (other.m_valid) {
cr(std::move(other.m_value));
}
......@@ -80,7 +82,9 @@ class optional {
return *this;
}
optional& operator=(optional&& other) {
optional& operator=(optional&& other)
noexcept(std::is_nothrow_destructible<T>::value &&
std::is_nothrow_move_assignable<T>::value) {
if (m_valid) {
if (other.m_valid) m_value = std::move(other.m_value);
else destroy();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment