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