folly::poly_cast

poly_cast overloads

Synopses

Declared in <folly/detail/PolyDetail.h>

template<
    class T,
    class I>
[[noreturn]]
/* implementation-defined */&
poly_cast(/* implementation-defined */&);
» more...

Returns a reference to the object of type T stored in a PolyRoot.

template<
    class T,
    class I>
/* implementation-defined */&
poly_cast(/* implementation-defined */& that);
» more...
template<
    class T,
    class I>
[[noreturn]]
/* implementation-defined */ const&
poly_cast(/* implementation-defined */ const&);
» more...

Returns a const reference to the object of type T stored in a PolyRoot.

template<
    class T,
    class I>
/* implementation-defined */ const&
poly_cast(/* implementation-defined */ const& that);
» more...
template<
    class T,
    class Poly>
requires detail::IsPoly<Poly>::value
constexpr
decltype(poly_cast<T>(std::declval<Poly>().get()))
poly_cast(Poly&& that);
» more...
template<
    class T,
    class I>
[[noreturn]]
/* implementation-defined */&&
poly_cast(/* implementation-defined */&&);
» more...

/////////////////////////////////////////////////////////////////////////////

template<
    class T,
    class I>
/* implementation-defined */&&
poly_cast(/* implementation-defined */&& that);
» more...

Return Value

  • A reference to the stored object cast to type T.
  • A const reference to the stored object cast to type T.
  • A reference to the T object stored in or referred to by that. Throws BadPolyAccess if that is empty. Throws BadPolyCast if that does not store or refer to an object of type T.

Template Parameters

NameDescription
TThe (unqualified) type to which to cast the Poly object.
PolyThe type of the Poly object.

Parameters

NameDescription
thatThe PolyRoot holding the object.