down_cast overloads

Synopses

Declared in <folly/lang/Cast.h>

Unchecked polymorphic down‐cast of a reference using static_cast, asserted in debug builds.

template<
    typename T,
    typename S>
like_t<S&&, T>
down_cast(S&& ref) noexcept;

Unchecked polymorphic down‐cast of a pointer using static_cast, asserted in debug builds.

template<
    typename T,
    typename S>
like_t<S, T>*
down_cast(S* ptr) noexcept;

Return Value

  • The reference down‐cast to T, preserving cvref per forward_like semantics

  • The pointer down‐cast to T, preserving cvref per forward_like semantics

Parameters

Name

Description

ref

Reference to a polymorphic base subobject of T

ptr

Pointer to a polymorphic base subobject of T

Created with MrDocs