proxygen
Poly.h File Reference
#include <cassert>
#include <new>
#include <type_traits>
#include <typeinfo>
#include <utility>
#include <folly/CPortability.h>
#include <folly/CppAttributes.h>
#include <folly/Traits.h>
#include <folly/detail/TypeList.h>
#include <folly/lang/Assume.h>
#include <folly/PolyException.h>
#include <folly/detail/PolyDetail.h>
#include <folly/Poly-inl.h>

Go to the source code of this file.

Classes

struct  folly::Poly< I >
 
struct  folly::PolyExtends< I >
 
struct  folly::PolyExtends< I >::Interface< Base >
 
struct  folly::Poly< I >
 

Namespaces

 folly
 —— Concurrent Priority Queue Implementation ——
 

Macros

#define FOLLY_INLINE_CONSTEXPR   constexpr
 
#define FOLLY_POLY_MEMBERS(...)
 
#define FOLLY_POLY_MEMBER(SIG, MEM)
 

Typedefs

template<class Node , class Tfx = detail::MetaIdentity, class Access = detail::PolyAccess>
using folly::PolySelf = decltype(Access::template self_< Node, Tfx >())
 
using folly::PolyDecay = detail::MetaQuote< std::decay_t >
 

Functions

template<std::size_t N, typename This , typename... As>
auto folly::poly_call (This &&_this, As &&...as) -> decltype(detail::PolyAccess::call< N >(static_cast< This && >(_this), static_cast< As && >(as)...))
 
template<std::size_t N, class I , class Tail , typename... As>
decltype(auto) folly::poly_call (detail::PolyNode< I, Tail > &&_this, As &&...as)
 
template<std::size_t N, class I , class Tail , typename... As>
decltype(auto) folly::poly_call (detail::PolyNode< I, Tail > &_this, As &&...as)
 
template<std::size_t N, class I , class Tail , typename... As>
decltype(auto) folly::poly_call (detail::PolyNode< I, Tail > const &_this, As &&...as)
 
template<std::size_t N, class I , class Poly , typename... As, std::enable_if_t< detail::IsPoly< Poly >::value, int > = 0>
auto folly::poly_call (Poly &&_this, As &&...as) -> decltype(poly_call< N, I >(static_cast< Poly && >(_this).get(), static_cast< As && >(as)...))
 
template<class T , class I >
detail::AddCvrefOf< T, I > && folly::poly_cast (detail::PolyRoot< I > &&that)
 
template<class T , class I >
detail::AddCvrefOf< T, I > & folly::poly_cast (detail::PolyRoot< I > &)
 
template<class T , class I >
detail::AddCvrefOf< T, I > const & folly::poly_cast (detail::PolyRoot< I > const &)
 
template<class T , class Poly , std::enable_if_t< detail::IsPoly< Poly >::value, int > = 0>
constexpr auto folly::poly_cast (Poly &&that) -> decltype(poly_cast< T >(std::declval< Poly >().get()))
 
template<class I >
std::type_info const & folly::poly_type (detail::PolyRoot< I > const &that) noexcept
 
template<class Poly , std::enable_if_t< detail::IsPoly< Poly >::value, int > = 0>
constexpr auto folly::poly_type (Poly const &that) noexcept-> decltype(poly_type(that.get()))
 
template<class I >
bool folly::poly_empty (detail::PolyRoot< I > const &that) noexcept
 
template<class I >
constexpr bool folly::poly_empty (detail::PolyRoot< I && > const &) noexcept
 
template<class I >
constexpr bool folly::poly_empty (detail::PolyRoot< I & > const &) noexcept
 
template<class I >
constexpr bool folly::poly_empty (Poly< I && > const &) noexcept
 
template<class I >
constexpr bool folly::poly_empty (Poly< I & > const &) noexcept
 
template<class I , std::enable_if_t< detail::Not< std::is_reference< I >>::value, int > = 0>
constexpr Poly< I > && folly::poly_move (detail::PolyRoot< I > &that) noexcept
 
template<class I , std::enable_if_t< detail::Not< std::is_const< I >>::value, int > = 0>
Poly< I && > folly::poly_move (detail::PolyRoot< I & > const &that) noexcept
 
template<class I >
Poly< I const & > folly::poly_move (detail::PolyRoot< I const & > const &that) noexcept
 
template<class Poly , std::enable_if_t< detail::IsPoly< Poly >::value, int > = 0>
constexpr auto folly::poly_move (Poly &that) noexcept-> decltype(poly_move(that.get()))
 
template<class I >
void folly::swap (Poly< I > &left, Poly< I > &right) noexcept
 

Variables

template<class Sig >
constexpr detail::Sig< Sig > const folly::sig = {}
 

Macro Definition Documentation

#define FOLLY_INLINE_CONSTEXPR   constexpr

Definition at line 45 of file Poly.h.

#define FOLLY_POLY_MEMBER (   SIG,
  MEM 
)
Value:
::folly::detail::MemberDef< \
::folly::detail::Member<decltype(::folly::sig<SIG>(MEM)), MEM>>::value
static const char *const value
Definition: Conv.cpp:50

Use FOLLY_POLY_MEMBER(SIG, MEM) on pre-C++17 compilers to specify a member function binding that needs to be disambiguated because of overloads. SIG should the (possibly const-qualified) signature of the MEM member function pointer.

For example:

struct IFoo {
  template <class Base> struct Interface : Base {
    int foo() const { return folly::poly_call<0>(*this); }
  };
  template <class T> using Members = FOLLY_POLY_MEMBERS(
    // This works even if T::foo is overloaded:
    FOLLY_POLY_MEMBER(int()const, &T::foo)
  );
};

Definition at line 158 of file Poly.h.

Referenced by TEST().

#define FOLLY_POLY_MEMBERS (   ...)
Value:
typename decltype(::folly::detail::deduceMembers( \
__VA_ARGS__))::template Members<__VA_ARGS__>

Use FOLLY_POLY_MEMBERS(MEMS...) on pre-C++17 compilers to specify a comma-separated list of member function bindings.

For example:

struct IFooBar {
  template <class Base>
  struct Interface : Base {
    int foo() const { return folly::poly_call<0>(*this); }
    void bar() { folly::poly_call<1>(*this); }
  };
  template <class T>
  using Members = FOLLY_POLY_MEMBERS(&T::foo, &T::bar);
};

Definition at line 136 of file Poly.h.

Referenced by TEST().