| 1109 | void swap(optional &other) |
| 1110 | #if optional_CPP11_OR_GREATER |
| 1111 | noexcept(std::is_nothrow_move_constructible<T>::value &&std17::is_nothrow_swappable<T>::value) |
| 1112 | #endif |
| 1113 | { |
| 1114 | using std::swap; |
| 1115 | if ((has_value() == true) && (other.has_value() == true)) { |
| 1116 | swap(**this, *other); |
| 1117 | } else if ((has_value() == false) && (other.has_value() == true)) { |
| 1118 | initialize(std11::move(*other)); |
| 1119 | other.reset(); |
| 1120 | } else if ((has_value() == true) && (other.has_value() == false)) { |
| 1121 | other.initialize(std11::move(**this)); |
| 1122 | reset(); |
| 1123 | } |
| 1124 | } |
| 1125 | |
| 1126 | // x.x.3.5, observers |
| 1127 |
no test coverage detected