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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef _LIBCPP___UTILITY_IN_PLACE_H
10 #define _LIBCPP___UTILITY_IN_PLACE_H
11 
12 #include <__config>
13 #include <type_traits>
14 
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #  pragma GCC system_header
17 #endif
18 
19 _LIBCPP_BEGIN_NAMESPACE_STD
20 
21 #if _LIBCPP_STD_VER > 14
22 
23 struct _LIBCPP_TYPE_VIS in_place_t {
24     explicit in_place_t() = default;
25 };
26 inline constexpr in_place_t in_place{};
27 
28 template <class _Tp>
29 struct _LIBCPP_TEMPLATE_VIS in_place_type_t {
30     explicit in_place_type_t() = default;
31 };
32 template <class _Tp>
33 inline constexpr in_place_type_t<_Tp> in_place_type{};
34 
35 template <size_t _Idx>
36 struct _LIBCPP_TEMPLATE_VIS in_place_index_t {
37     explicit in_place_index_t() = default;
38 };
39 template <size_t _Idx>
40 inline constexpr in_place_index_t<_Idx> in_place_index{};
41 
42 template <class _Tp> struct __is_inplace_type_imp : false_type {};
43 template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
44 
45 template <class _Tp>
46 using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>;
47 
48 template <class _Tp> struct __is_inplace_index_imp : false_type {};
49 template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
50 
51 template <class _Tp>
52 using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>;
53 
54 #endif // _LIBCPP_STD_VER > 14
55 
56 _LIBCPP_END_NAMESPACE_STD
57 
58 #endif // _LIBCPP___UTILITY_IN_PLACE_H
59