proxygen
folly::exception_wrapper_detail Namespace Reference

Classes

struct  catch_fn
 

Typedefs

template<template< class > class T, class... As>
using AllOf = StrictConjunction< T< As >... >
 
template<bool If, class T >
using AddConstIf = _t< std::conditional< If, const T, T >>
 

Functions

template<class Ex >
Ex && dont_slice (Ex &&ex)
 
template<class Ex , class Fn >
catch_fn< Ex, Fn > catch_ (Ex *, Fn fn)
 
template<class Fn >
Fn catch_ (void const *, Fn fn)
 
template<class Fn , class A >
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto fold (Fn &&, A &&a)
 
template<class Fn , class A , class B , class... Bs>
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto fold (Fn &&fn, A &&a, B &&b, Bs &&...bs)
 

Typedef Documentation

template<bool If, class T >
using folly::exception_wrapper_detail::AddConstIf = typedef _t<std::conditional<If, const T, T>>

Definition at line 65 of file ExceptionWrapper.h.

template<template< class > class T, class... As>
using folly::exception_wrapper_detail::AllOf = typedef StrictConjunction<T<As>...>

Definition at line 62 of file ExceptionWrapper.h.

Function Documentation

template<class Ex , class Fn >
catch_fn<Ex, Fn> folly::exception_wrapper_detail::catch_ ( Ex *  ,
Fn  fn 
)
inline

Definition at line 627 of file ExceptionWrapper-inl.h.

References folly::gen::move.

Referenced by folly::exception_wrapper::with_exception_().

627  {
628  return {std::move(fn)};
629 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class Fn >
Fn folly::exception_wrapper_detail::catch_ ( void const *  ,
Fn  fn 
)
inline

Definition at line 631 of file ExceptionWrapper-inl.h.

631  {
632  return fn;
633 }
template<class Ex >
Ex&& folly::exception_wrapper_detail::dont_slice ( Ex &&  ex)

Definition at line 345 of file ExceptionWrapper-inl.h.

References FOLLY_REQUIRES_DEF, and folly::value().

Referenced by folly::exception_wrapper::exception_wrapper().

345  {
346  assert(typeid(ex) == typeid(_t<std::decay<Ex>>) ||
347  !"Dynamic and static exception types don't match. Exception would "
348  "be sliced when storing in exception_wrapper.");
349  return std::forward<Ex>(ex);
350 }
typename T::type _t
Definition: Traits.h:171
template<class Fn , class A >
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto folly::exception_wrapper_detail::fold ( Fn &&  ,
A &&  a 
)

Definition at line 68 of file ExceptionWrapper.h.

References a, B, FOLLY_ALWAYS_INLINE, and FOLLY_ATTR_VISIBILITY_HIDDEN.

Referenced by fold(), folly::gen::foldl(), and folly::exception_wrapper::handle_().

68  {
69  return static_cast<A&&>(a);
70 }
std::unique_ptr< int > A
char a
template<class Fn , class A , class B , class... Bs>
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto folly::exception_wrapper_detail::fold ( Fn &&  fn,
A &&  a,
B &&  b,
Bs &&...  bs 
)

Definition at line 74 of file ExceptionWrapper.h.

References a, b, and fold().

74  {
75  return fold(
76  // This looks like a use of fn after a move of fn, but in reality, this is
77  // just a cast and not a move. That's because regardless of which fold
78  // overload is selected, fn gets bound to a &&. Had fold taken fn by value
79  // there would indeed be a problem here.
80  static_cast<Fn&&>(fn),
81  static_cast<Fn&&>(fn)(static_cast<A&&>(a), static_cast<B&&>(b)),
82  static_cast<Bs&&>(bs)...);
83 }
char b
char a
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto fold(Fn &&fn, A &&a, B &&b, Bs &&...bs)