Path: blob/main/contrib/llvm-project/libcxx/include/__utility/move.h
35236 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___UTILITY_MOVE_H10#define _LIBCPP___UTILITY_MOVE_H1112#include <__config>13#include <__type_traits/conditional.h>14#include <__type_traits/is_constructible.h>15#include <__type_traits/is_nothrow_constructible.h>16#include <__type_traits/remove_reference.h>1718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)19# pragma GCC system_header20#endif2122_LIBCPP_PUSH_MACROS23#include <__undef_macros>2425_LIBCPP_BEGIN_NAMESPACE_STD2627template <class _Tp>28_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&&29move(_LIBCPP_LIFETIMEBOUND _Tp&& __t) _NOEXCEPT {30typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up;31return static_cast<_Up&&>(__t);32}3334template <class _Tp>35using __move_if_noexcept_result_t =36__conditional_t<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>;3738template <class _Tp>39_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp>40move_if_noexcept(_LIBCPP_LIFETIMEBOUND _Tp& __x) _NOEXCEPT {41return std::move(__x);42}4344_LIBCPP_END_NAMESPACE_STD4546_LIBCPP_POP_MACROS4748#endif // _LIBCPP___UTILITY_MOVE_H495051