void clear() { if ( has_value ) { contained.destruct_value(); contained.construct_error( std::exception_ptr() ); } has_value = false; }
void clear() { if ( has_value ) { contained.destruct_value(); contained.construct_error( error_type() ); } has_value = false; }
void swap( expected & rhs ) { using std::swap; if ( has_value == true && rhs.has_value == true ) { swap( contained.value(), rhs.contained.value() ); } else if ( has_value == false && rhs.has_value == false ) { swap( contained.error(), rhs.contained.error() ); } else if ( has_value == false && rhs.has_value == true ) { rhs.swap( *this ); } else if ( has_value == true && rhs.has_value == false ) { error_type t = rhs.contained.error(); rhs.contained.destruct_error(); rhs.contained.construct_value( contained.value() ); contained.construct_error( t ); swap( has_value, rhs.has_value ); } }
expected( expected const & rhs ) : has_value( rhs.has_value ) { if ( has_value ) contained.construct_value( rhs.contained.value() ); else contained.construct_error( rhs.contained.error() ); }
expected( nullexp_t, error_type const & rhs ) : has_value( false ) { contained.construct_error( rhs ); }
expected() : has_value( false ) { contained.construct_error( std::exception_ptr() ); }
expected() : has_value( false ) { contained.construct_error( error_type() ); }