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

#include <Expected.h>

Public Types

using value_type = Value
 
using error_type = Error
 

Public Member Functions

template<class E = Error, class = decltype(E{})>
constexpr ExpectedStorage () noexcept(noexcept(E{}))
 
constexpr ExpectedStorage (EmptyTag) noexcept
 
template<class... Vs>
constexpr ExpectedStorage (ValueTag, Vs &&...vs) noexcept(noexcept(Value(static_cast< Vs && >(vs)...)))
 
template<class... Es>
constexpr ExpectedStorage (ErrorTag, Es &&...es) noexcept(noexcept(Error(static_cast< Es && >(es)...)))
 
void clear () noexcept
 
template<class... Vs>
void assignValue (Vs &&...vs)
 
template<class... Es>
void assignError (Es &&...es)
 
template<class Other >
void assign (Other &&that)
 
Value & value ()&
 
const Value & value () const &
 
Value && value ()&&
 
FOLLY_PUSH_WARNING FOLLY_MSVC_DISABLE_WARNING (4702) Error &error()&
 
const Error & error () const &
 
Error && error ()&&
 

Static Public Member Functions

static constexpr bool uninitializedByException () noexcept
 

Public Attributes

union {
   Value   value_
 
   Error   error_
 
   char   ch_
 
}; 
 
Which which_
 

Detailed Description

template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
struct folly::expected_detail::ExpectedStorage< Value, Error, StorageType >

Definition at line 185 of file Expected.h.

Member Typedef Documentation

template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
using folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::error_type = Error

Definition at line 187 of file Expected.h.

template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
using folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::value_type = Value

Definition at line 186 of file Expected.h.

Constructor & Destructor Documentation

template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
template<class E = Error, class = decltype(E{})>
constexpr folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::ExpectedStorage ( )
inlinenoexcept
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
constexpr folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::ExpectedStorage ( EmptyTag  )
inlineexplicitnoexcept
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
template<class... Vs>
constexpr folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::ExpectedStorage ( ValueTag  ,
Vs &&...  vs 
)
inlineexplicitnoexcept
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
template<class... Es>
constexpr folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::ExpectedStorage ( ErrorTag  ,
Es &&...  es 
)
inlineexplicitnoexcept

Member Function Documentation

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

Definition at line 225 of file Expected.h.

225  {
226  switch (that.which_) {
227  case Which::eValue:
228  this->assignValue(static_cast<Other&&>(that).value());
229  break;
230  case Which::eError:
231  this->assignError(static_cast<Other&&>(that).error());
232  break;
233  default:
234  this->clear();
235  break;
236  }
237  }
const Error & error() const &
Definition: Expected.h:255
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
template<class... Es>
void folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::assignError ( Es &&...  es)
inline

Definition at line 220 of file Expected.h.

220  {
221  expected_detail::doEmplaceAssign(0, error_, static_cast<Es&&>(es)...);
223  }
auto doEmplaceAssign(int, T &t, U &&u) -> decltype(void(t=static_cast< U && >(u)))
Definition: Expected.h:140
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
template<class... Vs>
void folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::assignValue ( Vs &&...  vs)
inline

Definition at line 215 of file Expected.h.

215  {
216  expected_detail::doEmplaceAssign(0, value_, static_cast<Vs&&>(vs)...);
218  }
auto doEmplaceAssign(int, T &t, U &&u) -> decltype(void(t=static_cast< U && >(u)))
Definition: Expected.h:140
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
void folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::clear ( )
inlinenoexcept

Definition at line 208 of file Expected.h.

208 {}
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
const Error& folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::error ( ) const
inline

Definition at line 255 of file Expected.h.

255  {
256  return error_;
257  }
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
Error&& folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::error ( )
inline

Definition at line 258 of file Expected.h.

258  {
259  return std::move(error_);
260  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
FOLLY_PUSH_WARNING folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::FOLLY_MSVC_DISABLE_WARNING ( 4702  )
inline

Definition at line 251 of file Expected.h.

252  {
253  return error_;
254  }
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
static constexpr bool folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::uninitializedByException ( )
inlinestaticnoexcept

Definition at line 209 of file Expected.h.

209  {
210  // Although which_ may temporarily be eEmpty during construction, it
211  // is always either eValue or eError for a fully-constructed Expected.
212  return false;
213  }
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
Value& folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::value ( )
inline

Definition at line 238 of file Expected.h.

238  {
239  return value_;
240  }
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
const Value& folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::value ( ) const
inline

Definition at line 241 of file Expected.h.

241  {
242  return value_;
243  }
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
Value&& folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::value ( )
inline

Definition at line 244 of file Expected.h.

244  {
245  return std::move(value_);
246  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Data Documentation

union { ... }
template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
char folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::ch_

Definition at line 191 of file Expected.h.

template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
Error folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::error_

Definition at line 190 of file Expected.h.

template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
Value folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::value_

Definition at line 189 of file Expected.h.

Referenced by folly::Expected< int, E >::Expected().

template<class Value, class Error, StorageType = expected_detail::getStorageType<Value, Error>()>
Which folly::expected_detail::ExpectedStorage< Value, Error, StorageType >::which_

Definition at line 193 of file Expected.h.


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