2021-06-09 23:10:17 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP___UTILITY_IN_PLACE_H
|
|
|
|
#define _LIBCPP___UTILITY_IN_PLACE_H
|
|
|
|
|
|
|
|
#include <__config>
|
2024-10-31 02:20:10 +01:00
|
|
|
#include <__cstddef/size_t.h>
|
2024-09-05 08:28:33 -04:00
|
|
|
#include <__type_traits/integral_constant.h>
|
2022-12-20 19:47:35 +01:00
|
|
|
#include <__type_traits/remove_cvref.h>
|
2021-06-09 23:10:17 +00:00
|
|
|
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2022-02-01 20:16:40 -05:00
|
|
|
# pragma GCC system_header
|
2021-06-09 23:10:17 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
2023-02-14 00:56:09 +01:00
|
|
|
#if _LIBCPP_STD_VER >= 17
|
2021-06-09 23:10:17 +00:00
|
|
|
|
2023-06-14 10:17:50 -07:00
|
|
|
struct _LIBCPP_EXPORTED_FROM_ABI in_place_t {
|
2023-01-23 10:27:14 +01:00
|
|
|
explicit in_place_t() = default;
|
2021-06-09 23:10:17 +00:00
|
|
|
};
|
2021-09-22 09:35:32 -04:00
|
|
|
inline constexpr in_place_t in_place{};
|
2021-06-09 23:10:17 +00:00
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
struct _LIBCPP_TEMPLATE_VIS in_place_type_t {
|
2023-01-23 10:27:14 +01:00
|
|
|
_LIBCPP_HIDE_FROM_ABI explicit in_place_type_t() = default;
|
2021-06-09 23:10:17 +00:00
|
|
|
};
|
|
|
|
template <class _Tp>
|
2021-09-22 09:35:32 -04:00
|
|
|
inline constexpr in_place_type_t<_Tp> in_place_type{};
|
2021-06-09 23:10:17 +00:00
|
|
|
|
|
|
|
template <size_t _Idx>
|
|
|
|
struct _LIBCPP_TEMPLATE_VIS in_place_index_t {
|
2023-05-31 12:23:37 -07:00
|
|
|
_LIBCPP_HIDE_FROM_ABI explicit in_place_index_t() = default;
|
2021-06-09 23:10:17 +00:00
|
|
|
};
|
|
|
|
template <size_t _Idx>
|
2021-09-22 09:35:32 -04:00
|
|
|
inline constexpr in_place_index_t<_Idx> in_place_index{};
|
2021-06-09 23:10:17 +00:00
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
struct __is_inplace_type_imp : false_type {};
|
|
|
|
template <class _Tp>
|
|
|
|
struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
|
|
|
|
|
|
|
|
template <class _Tp>
|
2025-01-08 17:12:59 +01:00
|
|
|
using __is_inplace_type _LIBCPP_NODEBUG = __is_inplace_type_imp<__remove_cvref_t<_Tp>>;
|
2021-06-09 23:10:17 +00:00
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
struct __is_inplace_index_imp : false_type {};
|
|
|
|
template <size_t _Idx>
|
|
|
|
struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
|
|
|
|
|
|
|
|
template <class _Tp>
|
2025-01-08 17:12:59 +01:00
|
|
|
using __is_inplace_index _LIBCPP_NODEBUG = __is_inplace_index_imp<__remove_cvref_t<_Tp>>;
|
2021-06-09 23:10:17 +00:00
|
|
|
|
2023-02-14 00:56:09 +01:00
|
|
|
#endif // _LIBCPP_STD_VER >= 17
|
2021-06-09 23:10:17 +00:00
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
|
|
|
#endif // _LIBCPP___UTILITY_IN_PLACE_H
|