1fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 2fe6060f1SDimitry Andric // 3fe6060f1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4fe6060f1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5fe6060f1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6fe6060f1SDimitry Andric // 7fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 8fe6060f1SDimitry Andric 9fe6060f1SDimitry Andric #ifndef _LIBCPP___UTILITY_IN_PLACE_H 10fe6060f1SDimitry Andric #define _LIBCPP___UTILITY_IN_PLACE_H 11fe6060f1SDimitry Andric 12fe6060f1SDimitry Andric #include <__config> 13bdd1243dSDimitry Andric #include <__type_traits/remove_cvref.h> 14bdd1243dSDimitry Andric #include <cstddef> 15fe6060f1SDimitry Andric 16fe6060f1SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 17fe6060f1SDimitry Andric # pragma GCC system_header 18fe6060f1SDimitry Andric #endif 19fe6060f1SDimitry Andric 20fe6060f1SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 21fe6060f1SDimitry Andric 2206c3fb27SDimitry Andric #if _LIBCPP_STD_VER >= 17 23fe6060f1SDimitry Andric 2406c3fb27SDimitry Andric struct _LIBCPP_EXPORTED_FROM_ABI in_place_t { 25fe6060f1SDimitry Andric explicit in_place_t() = default; 26fe6060f1SDimitry Andric }; 27349cc55cSDimitry Andric inline constexpr in_place_t in_place{}; 28fe6060f1SDimitry Andric 29fe6060f1SDimitry Andric template <class _Tp> 30fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS in_place_type_t { 3106c3fb27SDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit in_place_type_t() = default; 32fe6060f1SDimitry Andric }; 33fe6060f1SDimitry Andric template <class _Tp> 34349cc55cSDimitry Andric inline constexpr in_place_type_t<_Tp> in_place_type{}; 35fe6060f1SDimitry Andric 36fe6060f1SDimitry Andric template <size_t _Idx> 37fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS in_place_index_t { 3806c3fb27SDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit in_place_index_t() = default; 39fe6060f1SDimitry Andric }; 40fe6060f1SDimitry Andric template <size_t _Idx> 41349cc55cSDimitry Andric inline constexpr in_place_index_t<_Idx> in_place_index{}; 42fe6060f1SDimitry Andric 43*cb14a3feSDimitry Andric template <class _Tp> 44*cb14a3feSDimitry Andric struct __is_inplace_type_imp : false_type {}; 45*cb14a3feSDimitry Andric template <class _Tp> 46*cb14a3feSDimitry Andric struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {}; 47fe6060f1SDimitry Andric 48fe6060f1SDimitry Andric template <class _Tp> 49bdd1243dSDimitry Andric using __is_inplace_type = __is_inplace_type_imp<__remove_cvref_t<_Tp>>; 50fe6060f1SDimitry Andric 51*cb14a3feSDimitry Andric template <class _Tp> 52*cb14a3feSDimitry Andric struct __is_inplace_index_imp : false_type {}; 53*cb14a3feSDimitry Andric template <size_t _Idx> 54*cb14a3feSDimitry Andric struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {}; 55fe6060f1SDimitry Andric 56fe6060f1SDimitry Andric template <class _Tp> 57bdd1243dSDimitry Andric using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>; 58fe6060f1SDimitry Andric 5906c3fb27SDimitry Andric #endif // _LIBCPP_STD_VER >= 17 60fe6060f1SDimitry Andric 61fe6060f1SDimitry Andric _LIBCPP_END_NAMESPACE_STD 62fe6060f1SDimitry Andric 63fe6060f1SDimitry Andric #endif // _LIBCPP___UTILITY_IN_PLACE_H 64