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_MOVE_H
0011 #define _LIBCPP___CXX03___UTILITY_MOVE_H
0012 
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__type_traits/conditional.h>
0015 #include <__cxx03/__type_traits/is_constructible.h>
0016 #include <__cxx03/__type_traits/is_nothrow_constructible.h>
0017 #include <__cxx03/__type_traits/remove_reference.h>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_PUSH_MACROS
0024 #include <__cxx03/__undef_macros>
0025 
0026 _LIBCPP_BEGIN_NAMESPACE_STD
0027 
0028 template <class _Tp>
0029 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&&
0030 move(_LIBCPP_LIFETIMEBOUND _Tp&& __t) _NOEXCEPT {
0031   typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up;
0032   return static_cast<_Up&&>(__t);
0033 }
0034 
0035 template <class _Tp>
0036 using __move_if_noexcept_result_t =
0037     __conditional_t<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>;
0038 
0039 template <class _Tp>
0040 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp>
0041 move_if_noexcept(_LIBCPP_LIFETIMEBOUND _Tp& __x) _NOEXCEPT {
0042   return std::move(__x);
0043 }
0044 
0045 _LIBCPP_END_NAMESPACE_STD
0046 
0047 _LIBCPP_POP_MACROS
0048 
0049 #endif // _LIBCPP___CXX03___UTILITY_MOVE_H