]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/include/ext/pb_assoc/detail/ds_trait_imp.hpp
* typeck.c (build_modify_expr): Tidy diagnostic message.
[thirdparty/gcc.git] / libstdc++-v3 / include / ext / pb_assoc / detail / ds_trait_imp.hpp
1 // -*- C++ -*-
2
3 // Copyright (C) 2005 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 2, 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 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 // USA.
20
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
29
30 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
31
32 // Permission to use, copy, modify, sell, and distribute this software
33 // is hereby granted without fee, provided that the above copyright
34 // notice appears in all copies, and that both that copyright notice and
35 // this permission notice appear in supporting documentation. None of
36 // the above authors, nor IBM Haifa Research Laboratories, make any
37 // representation about the suitability of this software for any
38 // purpose. It is provided "as is" without express or implied warranty.
39
40 /**
41 * @file ds_trait_imp.hpp
42 * Contains data-structure traits implementation.
43 */
44
45 #ifndef DS_TRAIT_IMP_HPP
46 #define DS_TRAIT_IMP_HPP
47
48 namespace detail
49 {
50
51 template<class Cntnr, class DS_Category>
52 struct erase_can_throw_imp
53 {
54 enum
55 {
56 value =
57 pb_assoc::detail::is_same_type<
58 DS_Category,
59 ov_tree_ds_tag>::value
60 };
61 };
62
63 template<class Cntnr>
64 struct erase_can_throw_imp<
65 Cntnr,
66 compound_ds_tag>
67 {
68 enum
69 {
70 value = Cntnr::erase_can_throw
71 };
72 };
73
74 template<class Cntnr, class DS_Category>
75 struct erase_iterators_imp
76 {
77 enum
78 {
79 value =
80 pb_assoc::detail::is_same_type<
81 DS_Category,
82 rb_tree_ds_tag>::value ||
83 pb_assoc::detail::is_same_type<
84 DS_Category,
85 splay_tree_ds_tag>::value
86 };
87 };
88
89 template<class Cntnr>
90 struct erase_iterators_imp<
91 Cntnr,
92 compound_ds_tag>
93 {
94 enum
95 {
96 value = Cntnr::erase_iterators
97 };
98 };
99
100 template<class Cntnr, class DS_Category>
101 struct order_preserving_imp
102 {
103 enum
104 {
105 value =
106 pb_assoc::detail::is_same_type<
107 DS_Category,
108 rb_tree_ds_tag>::value ||
109 pb_assoc::detail::is_same_type<
110 DS_Category,
111 splay_tree_ds_tag>::value ||
112 pb_assoc::detail::is_same_type<
113 DS_Category,
114 ov_tree_ds_tag>::value
115 };
116 };
117
118 template<class Cntnr>
119 struct order_preserving_imp<
120 Cntnr,
121 compound_ds_tag>
122 {
123 enum
124 {
125 value = Cntnr::order_preserving
126 };
127 };
128
129 template<class Cntnr, class DS_Category>
130 struct invalidation_guarantee_imp
131 {
132 private:
133 enum
134 {
135 node_based =
136 pb_assoc::detail::is_same_type<
137 DS_Category,
138 cc_hash_ds_tag>::value ||
139 pb_assoc::detail::is_same_type<
140 DS_Category,
141 rb_tree_ds_tag>::value ||
142 pb_assoc::detail::is_same_type<
143 DS_Category,
144 splay_tree_ds_tag>::value ||
145 pb_assoc::detail::is_same_type<
146 DS_Category,
147 lu_ds_tag>::value
148 };
149
150 enum
151 {
152 vector_organized =
153 pb_assoc::detail::is_same_type<
154 DS_Category,
155 cc_hash_ds_tag>::value
156 };
157
158 public:
159 typedef
160 typename cond_type<
161 node_based,
162 typename cond_type<
163 vector_organized,
164 find_invalidation_guarantee,
165 range_invalidation_guarantee>::type,
166 basic_invalidation_guarantee>::type
167 type;
168 };
169
170 template<class Cntnr>
171 struct invalidation_guarantee_imp<
172 Cntnr,
173 compound_ds_tag>
174 {
175 typedef typename Cntnr::invalidation_guarantee type;
176 };
177
178 template<class Cntnr, class DS_Category>
179 struct reverse_iteration_imp
180 {
181 enum
182 {
183 value =
184 is_same_type<
185 DS_Category,
186 rb_tree_ds_tag>::value ||
187 is_same_type<
188 DS_Category,
189 splay_tree_ds_tag>::value
190 };
191 };
192
193 template<class Cntnr>
194 struct reverse_iteration_imp<
195 Cntnr,
196 compound_ds_tag>
197 {
198 enum
199 {
200 value = Cntnr::reverse_iteration
201 };
202 };
203
204 template<class Cntnr, class DS_Category>
205 struct split_join_imp
206 {
207 enum
208 {
209 value =
210 is_same_type<
211 DS_Category,
212 rb_tree_ds_tag>::value ||
213 is_same_type<
214 DS_Category,
215 splay_tree_ds_tag>::value ||
216 is_same_type<
217 DS_Category,
218 ov_tree_ds_tag>::value
219 };
220 };
221
222 template<class Cntnr>
223 struct split_join_imp<
224 Cntnr,
225 compound_ds_tag>
226 {
227 enum
228 {
229 value = false
230 };
231 };
232
233 template<class Cntnr>
234 struct basic_data_structure_traits
235 {
236
237 private:
238 typedef Cntnr cntnr;
239
240 typedef typename Cntnr::ds_category ds_category;
241
242 public:
243 enum
244 {
245 erase_can_throw =
246 pb_assoc::detail::erase_can_throw_imp<
247 cntnr,
248 ds_category>::value
249 };
250
251 enum
252 {
253 order_preserving =
254 pb_assoc::detail::order_preserving_imp<
255 cntnr,
256 ds_category>::value
257 };
258
259 enum
260 {
261 erase_iterators =
262 pb_assoc::detail::erase_iterators_imp<
263 Cntnr,
264 ds_category>::value
265 };
266
267 typedef
268 typename pb_assoc::detail::invalidation_guarantee_imp<
269 cntnr,
270 ds_category>::type
271 invalidation_guarantee;
272
273 enum
274 {
275 reverse_iteration =
276 pb_assoc::detail::reverse_iteration_imp<
277 cntnr,
278 ds_category>::value
279 };
280
281 enum
282 {
283 split_join =
284 pb_assoc::detail::split_join_imp<
285 cntnr,
286 ds_category>::value
287 };
288 };
289
290 template<class Cntnr, class DS_Category>
291 struct data_structure_traits : public basic_data_structure_traits<
292 Cntnr>
293 { };
294
295 template<class Cntnr>
296 struct data_structure_traits<
297 Cntnr,
298 rb_tree_ds_tag> : public basic_data_structure_traits<
299 Cntnr>
300 {
301 public:
302 enum
303 {
304 split_join_can_throw = false
305 };
306 };
307
308 template<class Cntnr>
309 struct data_structure_traits<
310 Cntnr,
311 splay_tree_ds_tag> : public basic_data_structure_traits<
312 Cntnr>
313 {
314 public:
315 enum
316 {
317 split_join_can_throw = false
318 };
319 };
320
321 template<class Cntnr>
322 struct data_structure_traits<
323 Cntnr,
324 ov_tree_ds_tag> : public basic_data_structure_traits<
325 Cntnr>
326 {
327 public:
328 enum
329 {
330 split_join_can_throw = true
331 };
332 };
333
334 } // namespace detail
335
336 #endif // #ifndef DS_TRAIT_IMP_HPP