xref: /openbsd-src/gnu/llvm/libcxx/include/__utility/in_place.h (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
176d0caaeSpatrick //===----------------------------------------------------------------------===//
276d0caaeSpatrick //
376d0caaeSpatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
476d0caaeSpatrick // See https://llvm.org/LICENSE.txt for license information.
576d0caaeSpatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
676d0caaeSpatrick //
776d0caaeSpatrick //===----------------------------------------------------------------------===//
876d0caaeSpatrick 
976d0caaeSpatrick #ifndef _LIBCPP___UTILITY_IN_PLACE_H
1076d0caaeSpatrick #define _LIBCPP___UTILITY_IN_PLACE_H
1176d0caaeSpatrick 
1276d0caaeSpatrick #include <__config>
13*4bdff4beSrobert #include <__type_traits/remove_cvref.h>
14*4bdff4beSrobert #include <cstddef>
1576d0caaeSpatrick 
1676d0caaeSpatrick #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1776d0caaeSpatrick #  pragma GCC system_header
1876d0caaeSpatrick #endif
1976d0caaeSpatrick 
2076d0caaeSpatrick _LIBCPP_BEGIN_NAMESPACE_STD
2176d0caaeSpatrick 
2276d0caaeSpatrick #if _LIBCPP_STD_VER > 14
2376d0caaeSpatrick 
2476d0caaeSpatrick struct _LIBCPP_TYPE_VIS in_place_t {
2576d0caaeSpatrick     explicit in_place_t() = default;
2676d0caaeSpatrick };
27*4bdff4beSrobert inline constexpr in_place_t in_place{};
2876d0caaeSpatrick 
2976d0caaeSpatrick template <class _Tp>
3076d0caaeSpatrick struct _LIBCPP_TEMPLATE_VIS in_place_type_t {
3176d0caaeSpatrick     explicit in_place_type_t() = default;
3276d0caaeSpatrick };
3376d0caaeSpatrick template <class _Tp>
34*4bdff4beSrobert inline constexpr in_place_type_t<_Tp> in_place_type{};
3576d0caaeSpatrick 
3676d0caaeSpatrick template <size_t _Idx>
3776d0caaeSpatrick struct _LIBCPP_TEMPLATE_VIS in_place_index_t {
3876d0caaeSpatrick     explicit in_place_index_t() = default;
3976d0caaeSpatrick };
4076d0caaeSpatrick template <size_t _Idx>
41*4bdff4beSrobert inline constexpr in_place_index_t<_Idx> in_place_index{};
4276d0caaeSpatrick 
4376d0caaeSpatrick template <class _Tp> struct __is_inplace_type_imp : false_type {};
4476d0caaeSpatrick template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
4576d0caaeSpatrick 
4676d0caaeSpatrick template <class _Tp>
47*4bdff4beSrobert using __is_inplace_type = __is_inplace_type_imp<__remove_cvref_t<_Tp>>;
4876d0caaeSpatrick 
4976d0caaeSpatrick template <class _Tp> struct __is_inplace_index_imp : false_type {};
5076d0caaeSpatrick template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
5176d0caaeSpatrick 
5276d0caaeSpatrick template <class _Tp>
53*4bdff4beSrobert using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>;
5476d0caaeSpatrick 
5576d0caaeSpatrick #endif // _LIBCPP_STD_VER > 14
5676d0caaeSpatrick 
5776d0caaeSpatrick _LIBCPP_END_NAMESPACE_STD
5876d0caaeSpatrick 
5976d0caaeSpatrick #endif // _LIBCPP___UTILITY_IN_PLACE_H
60