3 // Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
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 terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3, or (at your option) any later
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
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.
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/>.
25 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
27 // Permission to use, copy, modify, sell, and distribute this software
28 // is hereby granted without fee, provided that the above copyright
29 // notice appears in all copies, and that both that copyright notice
30 // and this permission notice appear in supporting documentation. None
31 // of the above authors, nor IBM Haifa Research Laboratories, make any
32 // representation about the suitability of this software for any
33 // purpose. It is provided "as is" without express or implied
37 * @file container_base_dispatch.hpp
38 * Contains an associative container dispatching base.
41 #ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
42 #define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
44 #include <ext/typelist.h>
46 #define PB_DS_DATA_TRUE_INDICATOR
47 #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
48 #undef PB_DS_DATA_TRUE_INDICATOR
50 #define PB_DS_DATA_FALSE_INDICATOR
51 #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
52 #undef PB_DS_DATA_FALSE_INDICATOR
54 #define PB_DS_DATA_TRUE_INDICATOR
55 #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
56 #undef PB_DS_DATA_TRUE_INDICATOR
58 #define PB_DS_DATA_FALSE_INDICATOR
59 #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
60 #undef PB_DS_DATA_FALSE_INDICATOR
62 #define PB_DS_DATA_TRUE_INDICATOR
63 #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
64 #undef PB_DS_DATA_TRUE_INDICATOR
66 #define PB_DS_DATA_FALSE_INDICATOR
67 #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
68 #undef PB_DS_DATA_FALSE_INDICATOR
70 #define PB_DS_DATA_TRUE_INDICATOR
71 #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
72 #undef PB_DS_DATA_TRUE_INDICATOR
74 #define PB_DS_DATA_FALSE_INDICATOR
75 #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
76 #undef PB_DS_DATA_FALSE_INDICATOR
78 #define PB_DS_DATA_TRUE_INDICATOR
79 #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
80 #undef PB_DS_DATA_TRUE_INDICATOR
82 #define PB_DS_DATA_FALSE_INDICATOR
83 #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
84 #undef PB_DS_DATA_FALSE_INDICATOR
86 #define PB_DS_DATA_TRUE_INDICATOR
87 #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
88 #undef PB_DS_DATA_TRUE_INDICATOR
90 #define PB_DS_DATA_FALSE_INDICATOR
91 #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
92 #undef PB_DS_DATA_FALSE_INDICATOR
94 #define PB_DS_DATA_TRUE_INDICATOR
95 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
96 #undef PB_DS_DATA_TRUE_INDICATOR
98 #define PB_DS_DATA_FALSE_INDICATOR
99 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
100 #undef PB_DS_DATA_FALSE_INDICATOR
107 template<typename Key
, typename Mapped
, typename Data_Structure_Taq
,
108 typename Policy_Tl
, typename Alloc
>
109 struct container_base_dispatch
;
111 template<typename Key
, typename Mapped
, typename Policy_Tl
, typename Alloc
>
112 struct container_base_dispatch
<Key
, Mapped
, list_update_tag
,
116 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
117 typedef typename
at0::type at0t
;
118 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
119 typedef typename
at1::type at1t
;
122 typedef lu_map_data_
<Key
, Mapped
, at0t
, Alloc
, at1t
> type
;
125 template<typename Key
, typename Policy_Tl
, typename Alloc
>
126 struct container_base_dispatch
<Key
, null_mapped_type
, list_update_tag
,
130 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
131 typedef typename
at0::type at0t
;
132 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
133 typedef typename
at1::type at1t
;
136 typedef lu_map_no_data_
<Key
, null_mapped_type
, at0t
, Alloc
, at1t
> type
;
139 template<typename Key
, typename Mapped
, typename Policy_Tl
, typename Alloc
>
140 struct container_base_dispatch
<Key
, Mapped
, pat_trie_tag
, Policy_Tl
, Alloc
>
143 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
144 typedef typename
at1::type at1t
;
147 typedef pat_trie_data_
<Key
, Mapped
, at1t
, Alloc
> type
;
150 template<typename Key
, typename Policy_Tl
, typename Alloc
>
151 struct container_base_dispatch
<Key
, null_mapped_type
, pat_trie_tag
,
155 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
156 typedef typename
at1::type at1t
;
159 typedef pat_trie_no_data_
<Key
, null_mapped_type
, at1t
, Alloc
> type
;
162 template<typename Key
, typename Mapped
, typename Policy_Tl
, typename Alloc
>
163 struct container_base_dispatch
<Key
, Mapped
, rb_tree_tag
, Policy_Tl
, Alloc
>
166 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
167 typedef typename
at0::type at0t
;
168 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
169 typedef typename
at1::type at1t
;
172 typedef rb_tree_data_
<Key
, Mapped
, at0t
, at1t
, Alloc
> type
;
175 template<typename Key
, typename Policy_Tl
, typename Alloc
>
176 struct container_base_dispatch
<Key
, null_mapped_type
, rb_tree_tag
,
180 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
181 typedef typename
at0::type at0t
;
182 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
183 typedef typename
at1::type at1t
;
186 typedef rb_tree_no_data_
<Key
, null_mapped_type
, at0t
, at1t
, Alloc
> type
;
189 template<typename Key
, typename Mapped
, typename Policy_Tl
, typename Alloc
>
190 struct container_base_dispatch
<Key
, Mapped
, splay_tree_tag
,
194 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
195 typedef typename
at0::type at0t
;
196 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
197 typedef typename
at1::type at1t
;
200 typedef splay_tree_data_
<Key
, Mapped
, at0t
, at1t
, Alloc
> type
;
203 template<typename Key
, typename Policy_Tl
, typename Alloc
>
204 struct container_base_dispatch
<Key
, null_mapped_type
, splay_tree_tag
,
208 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
209 typedef typename
at0::type at0t
;
210 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
211 typedef typename
at1::type at1t
;
214 typedef splay_tree_no_data_
<Key
, null_mapped_type
, at0t
, at1t
, Alloc
> type
;
217 template<typename Key
, typename Mapped
, typename Policy_Tl
, typename Alloc
>
218 struct container_base_dispatch
<Key
, Mapped
, ov_tree_tag
, Policy_Tl
, Alloc
>
221 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
222 typedef typename
at0::type at0t
;
223 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
224 typedef typename
at1::type at1t
;
227 typedef ov_tree_data_
<Key
, Mapped
, at0t
, at1t
, Alloc
> type
;
230 template<typename Key
, typename Policy_Tl
, typename Alloc
>
231 struct container_base_dispatch
<Key
, null_mapped_type
, ov_tree_tag
,
235 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
236 typedef typename
at0::type at0t
;
237 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
238 typedef typename
at1::type at1t
;
241 typedef ov_tree_no_data_
<Key
, null_mapped_type
, at0t
, at1t
, Alloc
> type
;
244 template<typename Key
, typename Mapped
, typename Policy_Tl
, typename Alloc
>
245 struct container_base_dispatch
<Key
, Mapped
, cc_hash_tag
, Policy_Tl
, Alloc
>
248 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
249 typedef typename
at0::type at0t
;
250 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
251 typedef typename
at1::type at1t
;
252 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 2> at2
;
253 typedef typename
at2::type at2t
;
254 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 3> at3
;
255 typedef typename
at3::type at3t
;
256 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 4> at4
;
257 typedef typename
at4::type at4t
;
260 typedef cc_ht_map_data_
<Key
, Mapped
, at0t
, at1t
, Alloc
, at3t::value
,
264 template<typename Key
, typename Policy_Tl
, typename Alloc
>
265 struct container_base_dispatch
<Key
, null_mapped_type
, cc_hash_tag
,
269 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
270 typedef typename
at0::type at0t
;
271 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
272 typedef typename
at1::type at1t
;
273 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 2> at2
;
274 typedef typename
at2::type at2t
;
275 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 3> at3
;
276 typedef typename
at3::type at3t
;
277 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 4> at4
;
278 typedef typename
at4::type at4t
;
281 typedef cc_ht_map_no_data_
<Key
, null_mapped_type
, at0t
, at1t
, Alloc
,
282 at3t::value
, at4t
, at2t
> type
;
285 template<typename Key
, typename Mapped
, typename Policy_Tl
, typename Alloc
>
286 struct container_base_dispatch
<Key
, Mapped
, gp_hash_tag
, Policy_Tl
, Alloc
>
289 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
290 typedef typename
at0::type at0t
;
291 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
292 typedef typename
at1::type at1t
;
293 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 2> at2
;
294 typedef typename
at2::type at2t
;
295 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 3> at3
;
296 typedef typename
at3::type at3t
;
297 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 4> at4
;
298 typedef typename
at4::type at4t
;
299 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 5> at5
;
300 typedef typename
at5::type at5t
;
303 typedef gp_ht_map_data_
<Key
, Mapped
, at0t
, at1t
, Alloc
, at3t::value
,
304 at4t
, at5t
, at2t
> type
;
307 template<typename Key
, typename Policy_Tl
, typename Alloc
>
308 struct container_base_dispatch
<Key
, null_mapped_type
, gp_hash_tag
,
312 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 0> at0
;
313 typedef typename
at0::type at0t
;
314 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 1> at1
;
315 typedef typename
at1::type at1t
;
316 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 2> at2
;
317 typedef typename
at2::type at2t
;
318 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 3> at3
;
319 typedef typename
at3::type at3t
;
320 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 4> at4
;
321 typedef typename
at4::type at4t
;
322 typedef __gnu_cxx::typelist::at_index
<Policy_Tl
, 5> at5
;
323 typedef typename
at5::type at5t
;
326 typedef gp_ht_map_no_data_
<Key
, null_mapped_type
, at0t
, at1t
, Alloc
,
327 at3t::value
, at4t
, at5t
, at2t
> type
;
329 } // namespace detail
330 } // namespace __gnu_pbds