libstdc++: inplace_tags.h Source File

libstdc++

inplace_tags.h
Go to the documentation of this file.
1// Tag types for inplace construction. -*- C++ -*-
2
3// Copyright (C) 2004-2026 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file include/bits/inplace_tags.h
26 * This is an internal header file, included by other library headers.
27 * Do not attempt to use it directly. @headername{utility}
28 *
29 * This file contains the parts of `<utility>` needed by other headers,
30 * so they don't need to include the whole of `<utility>`.
31 */
32
33#ifndef _GLIBCXX_INPLACE_TAGS_H
34#define _GLIBCXX_INPLACE_TAGS_H 1
35
36#ifdef _GLIBCXX_SYSHDR
37#pragma GCC system_header
38#endif
39
40#if __cplusplus >= 201703L
41
42namespace std _GLIBCXX_VISIBILITY(default)
43{
44_GLIBCXX_BEGIN_NAMESPACE_VERSION
45
46 struct in_place_t {
47 explicit in_place_t() = default;
48 };
49
50 inline constexpr in_place_t in_place{};
51
52 template<typename _Tp> struct in_place_type_t
53 {
54 explicit in_place_type_t() = default;
55 };
56
57 template<typename _Tp>
58 inline constexpr in_place_type_t<_Tp> in_place_type{};
59
60 template<size_t _Idx> struct in_place_index_t
61 {
62 explicit in_place_index_t() = default;
63 };
64
65 template<size_t _Idx>
66 inline constexpr in_place_index_t<_Idx> in_place_index{};
67
68 template<typename>
69 inline constexpr bool __is_in_place_type_v = false;
70
71 template<typename _Tp>
72 inline constexpr bool __is_in_place_type_v<in_place_type_t<_Tp>> = true;
73
74 template<typename>
75 inline constexpr bool __is_in_place_index_v = false;
76
77 template<size_t _Nm>
78 inline constexpr bool __is_in_place_index_v<in_place_index_t<_Nm>> = true;
79
80_GLIBCXX_END_NAMESPACE_VERSION
81} // namespace
82
83#endif // C++17
84#endif /* _GLIBCXX_INPLACE_TAGS_H */
std
ISO C++ entities toplevel namespace is std.