QtBase  v6.3.1
qcontainerinfo.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2020 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QCONTAINERINFO_H
41 #define QCONTAINERINFO_H
42 
43 #include <QtCore/qglobal.h>
44 #include <type_traits>
45 
47 
48 namespace QContainerInfo {
49 
50 template<typename C>
51 using value_type = typename C::value_type;
52 
53 template<typename C>
54 using key_type = typename C::key_type;
55 
56 template<typename C>
57 using mapped_type = typename C::mapped_type;
58 
59 template<typename C>
60 using iterator = typename C::iterator;
61 
62 template<typename C>
64 
65 // Some versions of Apple clang warn about the constexpr variables below being unused.
67 QT_WARNING_DISABLE_CLANG("-Wunused-const-variable")
68 
69 template<typename C, typename = void>
70 inline constexpr bool has_value_type_v = false;
71 template<typename C>
72 inline constexpr bool has_value_type_v<C, std::void_t<value_type<C>>> = true;
73 
74 template<typename C, typename = void>
75 inline constexpr bool has_key_type_v = false;
76 template<typename C>
77 inline constexpr bool has_key_type_v<C, std::void_t<key_type<C>>> = true;
78 
79 template<typename C, typename = void>
80 inline constexpr bool has_mapped_type_v = false;
81 template<typename C>
82 inline constexpr bool has_mapped_type_v<C, std::void_t<mapped_type<C>>> = true;
83 
84 template<typename C, typename = void>
85 inline constexpr bool has_size_v = false;
86 template<typename C>
87 inline constexpr bool has_size_v<C, std::void_t<decltype(C().size())>> = true;
88 
89 template<typename C, typename = void>
90 inline constexpr bool has_clear_v = false;
91 template<typename C>
92 inline constexpr bool has_clear_v<C, std::void_t<decltype(C().clear())>> = true;
93 
94 template<typename, typename = void>
95 inline constexpr bool has_at_index_v = false;
96 template<typename C>
97 inline constexpr bool has_at_index_v<C, std::void_t<decltype(C().at(0))>> = true;
98 
99 template<typename, typename = void>
100 inline constexpr bool has_at_key_v = false;
101 template<typename C>
102 inline constexpr bool has_at_key_v<C, std::void_t<decltype(C().at(key_type<C>()))>> = true;
103 
104 template<typename, typename = void>
105 inline constexpr bool can_get_at_index_v = false;
106 template<typename C>
107 inline constexpr bool can_get_at_index_v<C, std::void_t<value_type<C>(decltype(C()[0]))>> = true;
108 
109 template<typename, typename = void>
110 inline constexpr bool can_set_at_index_v = false;
111 template<typename C>
112 inline constexpr bool can_set_at_index_v<C, std::void_t<decltype(C()[0] = value_type<C>())>> = true;
113 
114 template<typename, typename = void>
115 inline constexpr bool has_push_front_v = false;
116 template<typename C>
117 inline constexpr bool has_push_front_v<C, std::void_t<decltype(C().push_front(value_type<C>()))>> = true;
118 
119 template<typename, typename = void>
120 inline constexpr bool has_push_back_v = false;
121 template<typename C>
122 inline constexpr bool has_push_back_v<C, std::void_t<decltype(C().push_back(value_type<C>()))>> = true;
123 
124 template<typename, typename = void>
125 inline constexpr bool has_insert_v = false;
126 template<typename C>
127 inline constexpr bool has_insert_v<C, std::void_t<decltype(C().insert(value_type<C>()))>> = true;
128 
129 template<typename, typename = void>
130 inline constexpr bool has_pop_front_v = false;
131 template<typename C>
132 inline constexpr bool has_pop_front_v<C, std::void_t<decltype(C().pop_front())>> = true;
133 
134 template<typename, typename = void>
135 inline constexpr bool has_pop_back_v = false;
136 template<typename C>
137 inline constexpr bool has_pop_back_v<C, std::void_t<decltype(C().pop_back())>> = true;
138 
139 template<typename, typename = void>
140 inline constexpr bool has_iterator_v = false;
141 template<typename C>
142 inline constexpr bool has_iterator_v<C, std::void_t<iterator<C>>> = true;
143 
144 template<typename, typename = void>
146 template<typename C>
147 inline constexpr bool has_const_iterator_v<C, std::void_t<const_iterator<C>>> = true;
148 
149 template<typename, typename = void>
151 template<typename C>
152 inline constexpr bool can_set_value_at_iterator_v<C, std::void_t<decltype(*C().begin() = value_type<C>())>> = true;
153 
154 template<typename, typename = void>
156 template<typename C>
157 inline constexpr bool can_set_mapped_at_iterator_v<C, std::void_t<decltype(*C().begin() = mapped_type<C>())>> = true;
158 
159 template<typename, typename = void>
161 template<typename C>
162 inline constexpr bool can_insert_value_at_iterator_v<C, std::void_t<decltype(C().insert(C().begin(), value_type<C>()))>> = true;
163 
164 template<typename, typename = void>
166 template<typename C>
167 inline constexpr bool can_erase_at_iterator_v<C, std::void_t<decltype(C().erase(C().begin()))>> = true;
168 
169 template<typename, typename = void>
171 template<typename C>
172 inline constexpr bool can_erase_range_at_iterator_v<C, std::void_t<decltype(C().erase(C().begin(), C().end()))>> = true;
173 
174 template<typename, typename = void>
175 inline constexpr bool can_get_at_key_v = false;
176 template<typename C>
177 inline constexpr bool can_get_at_key_v<C, std::void_t<mapped_type<C>(decltype(C()[key_type<C>()]))>> = true;
178 
179 template<typename, typename = void>
180 inline constexpr bool can_set_at_key_v = false;
181 template<typename C>
182 inline constexpr bool can_set_at_key_v<C, std::void_t<decltype(C()[key_type<C>()] = mapped_type<C>())>> = true;
183 
184 template<typename, typename = void>
185 inline constexpr bool can_erase_at_key_v = false;
186 template<typename C>
187 inline constexpr bool can_erase_at_key_v<C, std::void_t<decltype(C().erase(key_type<C>()))>> = true;
188 
189 template<typename, typename = void>
191 template<typename C>
192 inline constexpr bool can_remove_at_key_v<C, std::void_t<decltype(C().remove(key_type<C>()))>> = true;
193 
194 template<typename, typename = void>
195 inline constexpr bool can_insert_key_v = false;
196 template<typename C>
197 inline constexpr bool can_insert_key_v<C, std::void_t<decltype(C().insert(key_type<C>()))>> = true;
198 
199 template<typename, typename = void>
200 inline constexpr bool can_insert_pair_v = false;
201 template<typename C>
202 inline constexpr bool can_insert_pair_v<C, std::void_t<decltype(C().insert({key_type<C>(), mapped_type<C>()}))>> = true;
203 
204 template<typename, typename = void>
205 inline constexpr bool can_insert_key_mapped_v = false;
206 template<typename C>
207 inline constexpr bool can_insert_key_mapped_v<C, std::void_t<decltype(C().insert(key_type<C>(), mapped_type<C>()))>> = true;
208 
209 template<typename, typename = void>
210 inline constexpr bool has_contains_v = false;
211 template<typename C>
212 inline constexpr bool has_contains_v<C, std::void_t<decltype(bool(C().contains(key_type<C>())))>> = true;
213 
214 template<typename, typename = void>
215 inline constexpr bool has_find_v = false;
216 template<typename C>
217 inline constexpr bool has_find_v<C, std::void_t<decltype(C().find(key_type<C>()))>> = true;
218 
219 template<typename, typename = void>
220 inline constexpr bool iterator_dereferences_to_value_v = false;
221 template<typename C>
222 inline constexpr bool iterator_dereferences_to_value_v<C, std::void_t<decltype(value_type<C>(*C().begin()))>> = true;
223 
224 template<typename, typename = void>
225 inline constexpr bool iterator_has_key_v = false;
226 template<typename C>
227 inline constexpr bool iterator_has_key_v<C, std::void_t<decltype(key_type<C>(C().begin().key()))>> = true;
228 
229 template<typename, typename = void>
230 inline constexpr bool value_type_has_first_v = false;
231 template<typename C>
232 inline constexpr bool value_type_has_first_v<C, std::void_t<decltype(key_type<C>(value_type<C>().first))>> = true;
233 
234 template<typename, typename = void>
235 inline constexpr bool iterator_dereferences_to_key_v = false;
236 template<typename C>
237 inline constexpr bool iterator_dereferences_to_key_v<C, std::void_t<decltype(key_type<C>(*C().begin()))>> = true;
238 
239 template<typename, typename = void>
240 inline constexpr bool iterator_has_value_v = false;
241 template<typename C>
242 inline constexpr bool iterator_has_value_v<C, std::void_t<decltype(mapped_type<C>(C().begin().value()))>> = true;
243 
244 template<typename, typename = void>
245 inline constexpr bool value_type_has_second_v = false;
246 template<typename C>
247 inline constexpr bool value_type_has_second_v<C, std::void_t<decltype(mapped_type<C>(value_type<C>().second))>> = true;
248 
249 template<typename, typename = void>
250 inline constexpr bool iterator_dereferences_to_mapped_v = false;
251 template<typename C>
252 inline constexpr bool iterator_dereferences_to_mapped_v<C, std::void_t<decltype(mapped_type<C>(*C().begin()))>> = true;
253 
255 
256 }
257 
259 
260 #endif // QCONTAINERINFO_H
#define value
[5]
map insert("Paris", "France")
b clear()
set contains("Julia")
#define true
Definition: ftrandom.c:51
#define inline
Definition: md4c.c:45
constexpr bool has_push_back_v
constexpr bool has_push_front_v
constexpr bool can_erase_at_key_v
constexpr bool can_set_value_at_iterator_v
constexpr bool has_iterator_v
constexpr bool has_insert_v
constexpr bool can_erase_at_iterator_v
typename C::value_type value_type
constexpr bool can_set_at_index_v
constexpr bool iterator_has_value_v
constexpr bool has_pop_back_v
constexpr bool has_mapped_type_v
constexpr bool has_contains_v
constexpr bool iterator_has_key_v
constexpr bool can_insert_key_mapped_v
constexpr bool can_get_at_key_v
constexpr bool iterator_dereferences_to_value_v
constexpr bool can_remove_at_key_v
constexpr bool iterator_dereferences_to_mapped_v
constexpr bool can_set_mapped_at_iterator_v
constexpr bool can_insert_pair_v
constexpr bool value_type_has_first_v
constexpr bool can_erase_range_at_iterator_v
constexpr bool value_type_has_second_v
typename C::const_iterator const_iterator
constexpr QT_WARNING_PUSH bool has_value_type_v
constexpr bool has_key_type_v
constexpr bool iterator_dereferences_to_key_v
constexpr bool has_clear_v
typename C::key_type key_type
typename C::mapped_type mapped_type
constexpr bool has_at_key_v
constexpr bool can_insert_key_v
constexpr bool has_pop_front_v
constexpr bool has_at_index_v
constexpr bool can_set_at_key_v
constexpr bool can_get_at_index_v
constexpr bool has_find_v
constexpr bool can_insert_value_at_iterator_v
constexpr bool has_size_v
typename C::iterator iterator
constexpr bool has_const_iterator_v
Definition: qfloat16.h:381
qsizetype erase(QByteArray &ba, const T &t)
Definition: qbytearray.h:670
#define QT_WARNING_POP
#define QT_WARNING_PUSH
#define QT_WARNING_DISABLE_CLANG(text)
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLuint end
GLint first
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
settings remove("monkey")
QAction * at
QDomElement find(const QString &tagName, const QDomElement &e)
Definition: main.cpp:39