proxygen
folly::gen::detail::UnwrapOr< T > Class Template Reference

#include <Base-inl.h>

Public Member Functions

 UnwrapOr (T &&value)
 
 UnwrapOr (const T &value)
 
Tvalue ()
 
const Tvalue () const
 

Private Attributes

T value_
 

Detailed Description

template<class T>
class folly::gen::detail::UnwrapOr< T >

UnwrapOr - For unwrapping folly::Optional values, or providing the given fallback value. Usually used through the 'unwrapOr' helper like so:

auto best = from(scores) | max | unwrapOr(-1);

Note that the fallback value needn't match the value in the Optional it is unwrapping. If mis-matched types are supported, the common type of the two is returned by value. If the types match, a reference (T&& > T& > const T&) is returned.

Definition at line 2363 of file Base-inl.h.

Constructor & Destructor Documentation

template<class T>
folly::gen::detail::UnwrapOr< T >::UnwrapOr ( T &&  value)
inlineexplicit

Definition at line 2365 of file Base-inl.h.

2365 : value_(std::move(value)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class T>
folly::gen::detail::UnwrapOr< T >::UnwrapOr ( const T value)
inlineexplicit

Definition at line 2366 of file Base-inl.h.

Member Function Documentation

template<class T>
T& folly::gen::detail::UnwrapOr< T >::value ( )
inline

Definition at line 2368 of file Base-inl.h.

Referenced by folly::gen::detail::operator|().

2368  {
2369  return value_;
2370  }
template<class T>
const T& folly::gen::detail::UnwrapOr< T >::value ( ) const
inline

Definition at line 2371 of file Base-inl.h.

2371  {
2372  return value_;
2373  }

Member Data Documentation

template<class T>
T folly::gen::detail::UnwrapOr< T >::value_
private

Definition at line 2376 of file Base-inl.h.


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