proxygen
folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion > Struct Template Reference

#include <Expected.h>

Inheritance diagram for folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >:
folly::expected_detail::ExpectedUnion< Value, Error > folly::expected_detail::CopyConstructible< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< std::is_copy_constructible, Value, Error >::value, StrictAllOf< std::is_nothrow_copy_constructible, Value, Error >::value > folly::expected_detail::MoveConstructible< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< std::is_move_constructible, Value, Error >::value, StrictAllOf< std::is_nothrow_move_constructible, Value, Error >::value > folly::expected_detail::CopyAssignable< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< IsCopyable, Value, Error >::value, StrictAllOf< IsNothrowCopyable, Value, Error >::value > folly::expected_detail::MoveAssignable< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< IsMovable, Value, Error >::value, StrictAllOf< IsNothrowMovable, Value, Error >::value >

Public Types

using value_type = Value
 
using error_type = Error
 
using Base = ExpectedUnion< Value, Error >
 

Public Member Functions

template<class E = Error, class = decltype(E{})>
constexpr ExpectedStorage () noexcept(noexcept(E{}))
 
 ExpectedStorage (const ExpectedStorage &)=default
 
 ExpectedStorage (ExpectedStorage &&)=default
 
ExpectedStorageoperator= (const ExpectedStorage &)=default
 
ExpectedStorageoperator= (ExpectedStorage &&)=default
 
 ~ExpectedStorage ()
 
void clear () noexcept
 
bool uninitializedByException () const noexcept
 
template<class... Vs>
void assignValue (Vs &&...vs)
 
template<class... Es>
void assignError (Es &&...es)
 
bool isSelfAssign (const ExpectedStorage *that) const
 
constexpr bool isSelfAssign (const void *) const
 
template<class Other >
void assign (Other &&that)
 
- Public Member Functions inherited from folly::expected_detail::ExpectedUnion< Value, Error >
constexpr ExpectedUnion (EmptyTag) noexcept
 
template<class... Vs>
constexpr ExpectedUnion (ValueTag, Vs &&...vs) noexcept(noexcept(Value(static_cast< Vs && >(vs)...)))
 
template<class... Es>
constexpr ExpectedUnion (ErrorTag, Es &&...es) noexcept(noexcept(Error(static_cast< Es && >(es)...)))
 
 ExpectedUnion (const ExpectedUnion &)
 
 ExpectedUnion (ExpectedUnion &&) noexcept
 
ExpectedUnionoperator= (const ExpectedUnion &)
 
ExpectedUnionoperator= (ExpectedUnion &&) noexcept
 
 ~ExpectedUnion ()
 
Value & value ()&
 
const Value & value () const &
 
Value && value ()&&
 
Error & error ()&
 
const Error & error () const &
 
Error && error ()&&
 
- Public Member Functions inherited from folly::expected_detail::CopyConstructible< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< std::is_copy_constructible, Value, Error >::value, StrictAllOf< std::is_nothrow_copy_constructible, Value, Error >::value >
constexpr CopyConstructible ()=default
 
 CopyConstructible (const CopyConstructible &that) noexcept(Noexcept)
 
constexpr CopyConstructible (CopyConstructible &&)=default
 
CopyConstructibleoperator= (const CopyConstructible &)=default
 
CopyConstructibleoperator= (CopyConstructible &&)=default
 
- Public Member Functions inherited from folly::expected_detail::MoveConstructible< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< std::is_move_constructible, Value, Error >::value, StrictAllOf< std::is_nothrow_move_constructible, Value, Error >::value >
constexpr MoveConstructible ()=default
 
constexpr MoveConstructible (const MoveConstructible &)=default
 
 MoveConstructible (MoveConstructible &&that) noexcept(Noexcept)
 
MoveConstructibleoperator= (const MoveConstructible &)=default
 
MoveConstructibleoperator= (MoveConstructible &&)=default
 
- Public Member Functions inherited from folly::expected_detail::CopyAssignable< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< IsCopyable, Value, Error >::value, StrictAllOf< IsNothrowCopyable, Value, Error >::value >
constexpr CopyAssignable ()=default
 
constexpr CopyAssignable (const CopyAssignable &)=default
 
constexpr CopyAssignable (CopyAssignable &&)=default
 
CopyAssignableoperator= (const CopyAssignable &that) noexcept(Noexcept)
 
CopyAssignableoperator= (CopyAssignable &&)=default
 
- Public Member Functions inherited from folly::expected_detail::MoveAssignable< ExpectedStorage< Value, Error, StorageType::eUnion >, StrictAllOf< IsMovable, Value, Error >::value, StrictAllOf< IsNothrowMovable, Value, Error >::value >
constexpr MoveAssignable ()=default
 
constexpr MoveAssignable (const MoveAssignable &)=default
 
constexpr MoveAssignable (MoveAssignable &&)=default
 
MoveAssignableoperator= (const MoveAssignable &)=default
 
MoveAssignableoperator= (MoveAssignable &&that) noexcept(Noexcept)
 

Additional Inherited Members

- Public Attributes inherited from folly::expected_detail::ExpectedUnion< Value, Error >
union {
   Value   value_
 
   Error   error_
 
   char   ch_ {}
 
}; 
 
Which which_ = Which::eEmpty
 

Detailed Description

template<class Value, class Error>
struct folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >

Definition at line 394 of file Expected.h.

Member Typedef Documentation

template<class Value , class Error >
using folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::Base = ExpectedUnion<Value, Error>

Definition at line 414 of file Expected.h.

template<class Value , class Error >
using folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::error_type = Error

Definition at line 413 of file Expected.h.

template<class Value , class Error >
using folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::value_type = Value

Definition at line 412 of file Expected.h.

Constructor & Destructor Documentation

template<class Value , class Error >
template<class E = Error, class = decltype(E{})>
constexpr folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::ExpectedStorage ( )
inlinenoexcept

Definition at line 416 of file Expected.h.

416 {})) : Base{ErrorTag{}} {}
template<class Value , class Error >
folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::ExpectedStorage ( const ExpectedStorage< Value, Error, StorageType::eUnion > &  )
default
template<class Value , class Error >
folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::ExpectedStorage ( ExpectedStorage< Value, Error, StorageType::eUnion > &&  )
default
template<class Value , class Error >
folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::~ExpectedStorage ( )
inline

Definition at line 422 of file Expected.h.

Member Function Documentation

template<class Value , class Error >
template<class Other >
void folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::assign ( Other &&  that)
inline

Definition at line 472 of file Expected.h.

References folly::expected_detail::eError, folly::pushmi::operators::error(), folly::expected_detail::eValue, and folly::value().

472  {
473  if (isSelfAssign(&that)) {
474  return;
475  }
476  switch (that.which_) {
477  case Which::eValue:
478  this->assignValue(static_cast<Other&&>(that).value());
479  break;
480  case Which::eError:
481  this->assignError(static_cast<Other&&>(that).error());
482  break;
483  default:
484  this->clear();
485  break;
486  }
487  }
template<class Value , class Error >
template<class... Es>
void folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::assignError ( Es &&...  es)
inline

Definition at line 454 of file Expected.h.

References folly::expected_detail::doEmplaceAssign(), folly::expected_detail::eError, and folly::pushmi::operators::error().

454  {
455  if (this->which_ == Which::eError) {
457  0, this->error(), static_cast<Es&&>(es)...);
458  } else {
459  this->clear();
460  ::new ((void*)std::addressof(this->error()))
461  Error(static_cast<Es&&>(es)...);
462  this->which_ = Which::eError;
463  }
464  }
auto doEmplaceAssign(int, T &t, U &&u) -> decltype(void(t=static_cast< U && >(u)))
Definition: Expected.h:140
template<class Value , class Error >
template<class... Vs>
void folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::assignValue ( Vs &&...  vs)
inline

Definition at line 442 of file Expected.h.

References folly::expected_detail::doEmplaceAssign(), folly::expected_detail::eValue, folly::value(), and testing::Value().

442  {
443  if (this->which_ == Which::eValue) {
445  0, this->value(), static_cast<Vs&&>(vs)...);
446  } else {
447  this->clear();
448  ::new ((void*)std::addressof(this->value()))
449  Value(static_cast<Vs&&>(vs)...);
450  this->which_ = Which::eValue;
451  }
452  }
auto doEmplaceAssign(int, T &t, U &&u) -> decltype(void(t=static_cast< U && >(u)))
Definition: Expected.h:140
bool Value(const T &value, M matcher)
template<class Value , class Error >
void folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::clear ( )
inlinenoexcept

Definition at line 425 of file Expected.h.

References folly::expected_detail::eEmpty, folly::expected_detail::eError, folly::pushmi::operators::error(), folly::expected_detail::eValue, and folly::value().

425  {
426  switch (this->which_) {
427  case Which::eValue:
428  this->value().~Value();
429  break;
430  case Which::eError:
431  this->error().~Error();
432  break;
433  default:
434  break;
435  }
436  this->which_ = Which::eEmpty;
437  }
template<class Value , class Error >
bool folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::isSelfAssign ( const ExpectedStorage< Value, Error, StorageType::eUnion > *  that) const
inline

Definition at line 465 of file Expected.h.

465  {
466  return this == that;
467  }
template<class Value , class Error >
constexpr bool folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::isSelfAssign ( const void *  ) const
inline

Definition at line 468 of file Expected.h.

468  {
469  return false;
470  }
template<class Value , class Error >
ExpectedStorage& folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::operator= ( const ExpectedStorage< Value, Error, StorageType::eUnion > &  )
default
template<class Value , class Error >
ExpectedStorage& folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::operator= ( ExpectedStorage< Value, Error, StorageType::eUnion > &&  )
default
template<class Value , class Error >
bool folly::expected_detail::ExpectedStorage< Value, Error, StorageType::eUnion >::uninitializedByException ( ) const
inlinenoexcept

Definition at line 438 of file Expected.h.

References folly::expected_detail::eEmpty.


The documentation for this struct was generated from the following file: