folly::like_t

like like_t

Synopsis

Declared in <folly/Traits.h>

template<
    typename Src,
    typename Dst>
using like_t = /* implementation-defined */::apply</* implementation-defined */>;

Description

Similar to like and like_t from p0847r0, but with semantics made compatible with the C++23 std::forward_like from p2445r0.

Differences:

  • Never removes const qualifiers from Dst.

  • Leaves any volatile as it was on Dst, Src volatility is ignored.

  • Unlike __forward_like_t from p2445r0, distinguishes between value Src and rvalue-reference Src types.

The above are the right semantics for most cases.

The rare cases which need to replace all cvref qualifiers from Src onto Dst may use copy_cvref_t. But heed the cautions in its documentation.

mimic: like, p0847r0