File indexing completed on 2026-05-03 08:14:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___UTILITY_FORWARD_H
0011 #define _LIBCPP___UTILITY_FORWARD_H
0012
0013 #include <__config>
0014 #include <__type_traits/is_reference.h>
0015 #include <__type_traits/remove_reference.h>
0016
0017 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0018 # pragma GCC system_header
0019 #endif
0020
0021 _LIBCPP_BEGIN_NAMESPACE_STD
0022
0023 template <class _Tp>
0024 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&&
0025 forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>& __t) _NOEXCEPT {
0026 return static_cast<_Tp&&>(__t);
0027 }
0028
0029 template <class _Tp>
0030 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&&
0031 forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>&& __t) _NOEXCEPT {
0032 static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue");
0033 return static_cast<_Tp&&>(__t);
0034 }
0035
0036 _LIBCPP_END_NAMESPACE_STD
0037
0038 #endif