21#ifndef __cpp_lib_forward_like
23 template <
typename T,
typename U>
24 using override_ref_t = conditional_t<is_rvalue_reference_v<T>, remove_reference_t<U> &&, U &>;
26 template <
typename T,
typename U>
27 using copy_const_t = conditional_t<is_const_v<remove_reference_t<T>>, U
const, U>;
29 template <
typename T,
typename U>
52 [[nodiscard]]
constexpr
override_ref_t< T &&, copy_const_t< T, remove_reference_t< U > > > forward_like_t
conditional_t< is_rvalue_reference_v< T >, remove_reference_t< U > &&, U & > override_ref_t
conditional_t< is_const_v< remove_reference_t< T > >, U const, U > copy_const_t
constexpr auto forward_like(auto &&x) noexcept -> detail::forward_like_t< T, decltype(x)>
Returns a reference to x which has similar properties to T&&.