Within the definition of interface I, PolySelf<Base> is an alias for the instance of Poly that is currently being instantiated. It is one of: Poly<J>, Poly<J&&>, Poly<J&>, or Poly<J const&>; where J is either I or some interface that extends I.

Synopsis

Declared in <folly/Poly.h>

template<
    class Node,
    class Tfx = /* implementation-defined */,
    class Access = /* implementation-defined */>
using PolySelf = _t<PolySelf_<Node, Tfx, Access>>;

Description

It can be used within interface definitions to declare members that accept other Poly objects of the same type as *this.

The first parameter may optionally be cv‐ and/or reference‐qualified, in which case, the qualification is applies to the type of the interface in the resulting Poly<> instance. The second template parameter controls whether or not the interface is decayed before the cv‐ref qualifiers of the first argument are applied. For example, given the following:

struct Foo { template <class Base> struct Interface : Base { using A = PolySelf<Base>; using B = PolySelf<Base &>; using C = PolySelf<Base const &>; using X = PolySelf<Base, PolyDecay>; using Y = PolySelf<Base &, PolyDecay>; using Z = PolySelf<Base const &, PolyDecay>; }; // ... }; struct Bar : PolyExtends<Foo> { // ... };

Then for Poly<Bar>, the typedefs are aliases for the following types:

  • A is Poly<Bar>

  • B is Poly<Bar &>

  • C is Poly<Bar const &>

  • X is Poly<Bar>

  • Y is Poly<Bar &>

  • Z is Poly<Bar const &>

And for Poly<Bar &>, the typedefs are aliases for the following types:

  • A is Poly<Bar &>

  • B is Poly<Bar &>

  • C is Poly<Bar &>

  • X is Poly<Bar>

  • Y is Poly<Bar &>

  • Z is Poly<Bar const &>

Created with MrDocs