Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:45

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03___UTILITY_FORWARD_H
0011 #define _LIBCPP___CXX03___UTILITY_FORWARD_H
0012 
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__type_traits/is_reference.h>
0015 #include <__cxx03/__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 _LIBCPP_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 _LIBCPP_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 // _LIBCPP___CXX03___UTILITY_FORWARD_H