Path: blob/main/contrib/llvm-project/libcxx/include/__new/launder.h
213766 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___NEW_LAUNDER_H9#define _LIBCPP___NEW_LAUNDER_H1011#include <__config>12#include <__type_traits/is_function.h>13#include <__type_traits/is_void.h>1415#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)16# pragma GCC system_header17#endif1819_LIBCPP_BEGIN_NAMESPACE_STD20template <class _Tp>21[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT {22static_assert(!(is_function<_Tp>::value), "can't launder functions");23static_assert(!is_void<_Tp>::value, "can't launder cv-void");24return __builtin_launder(__p);25}2627#if _LIBCPP_STD_VER >= 1728template <class _Tp>29[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp* launder(_Tp* __p) noexcept {30return std::__launder(__p);31}32#endif33_LIBCPP_END_NAMESPACE_STD3435#endif // _LIBCPP___NEW_LAUNDER_H363738