GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / arm-brcm-linux-uclibcgnueabi / include / c++ / 4.5.3 / ext / pb_ds / detail / basic_types.hpp
blobaac1397ddfb76c307d73b5cf71c8ed3fc3c28570
1 // -*- C++ -*-
3 // Copyright (C) 2005, 2006, 2009 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 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
9 // version.
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
34 // warranty.
36 /**
37 * @file basic_types.hpp
38 * Contains basic types used by containers.
41 #ifndef PB_DS_BASIC_TYPES_HPP
42 #define PB_DS_BASIC_TYPES_HPP
44 #include <algorithm>
45 #include <utility>
46 #include <ext/pb_ds/tag_and_trait.hpp>
47 #include <ext/pb_ds/detail/type_utils.hpp>
49 namespace __gnu_pbds
51 namespace detail
53 template<typename Key, typename Mapped, typename Allocator, bool Store_Hash>
54 struct value_type_base;
56 /**
57 * Specialization of value_type_base for the case where the hash value
58 * is not stored alongside each value.
59 **/
60 template<typename Key, typename Mapped, typename Allocator>
61 struct value_type_base<Key, Mapped, Allocator, false>
63 typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
64 typedef typename mapped_type_allocator::value_type mapped_type;
65 typedef typename mapped_type_allocator::pointer mapped_pointer;
66 typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
67 typedef typename mapped_type_allocator::reference mapped_reference;
68 typedef typename mapped_type_allocator::const_reference const_mapped_reference;
70 typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
71 typedef typename value_type_allocator::value_type value_type;
72 typedef typename value_type_allocator::pointer pointer;
73 typedef typename value_type_allocator::const_pointer const_pointer;
74 typedef typename value_type_allocator::reference reference;
75 typedef typename value_type_allocator::const_reference const_reference;
77 struct stored_value_type
79 value_type m_value;
83 /**
84 * Specialization of value_type_base for the case where the hash value
85 * is stored alongside each value.
86 **/
87 template<typename Key, typename Mapped, typename Allocator>
88 struct value_type_base<Key, Mapped, Allocator, true>
90 typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
91 typedef typename mapped_type_allocator::value_type mapped_type;
92 typedef typename mapped_type_allocator::pointer mapped_pointer;
93 typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
94 typedef typename mapped_type_allocator::reference mapped_reference;
95 typedef typename mapped_type_allocator::const_reference const_mapped_reference;
97 typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
98 typedef typename value_type_allocator::value_type value_type;
99 typedef typename value_type_allocator::pointer pointer;
100 typedef typename value_type_allocator::const_pointer const_pointer;
101 typedef typename value_type_allocator::reference reference;
102 typedef typename value_type_allocator::const_reference const_reference;
104 struct stored_value_type
106 value_type m_value;
107 typename Allocator::size_type m_hash;
111 #define PB_DS_CLASS_T_DEC \
112 template<typename Key, typename Allocator>
114 #define PB_DS_CLASS_C_DEC \
115 value_type_base<Key, null_mapped_type, Allocator, false>
118 * Specialization of value_type_base for the case where the hash value
119 * is not stored alongside each value.
121 template<typename Key, typename Allocator>
122 struct value_type_base<Key, null_mapped_type, Allocator, false>
124 typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
125 typedef typename mapped_type_allocator::value_type mapped_type;
126 typedef typename mapped_type_allocator::pointer mapped_pointer;
127 typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
128 typedef typename mapped_type_allocator::reference mapped_reference;
129 typedef typename mapped_type_allocator::const_reference const_mapped_reference;
131 typedef Key value_type;
133 typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
134 typedef typename value_type_allocator::pointer pointer;
135 typedef typename value_type_allocator::const_pointer const_pointer;
136 typedef typename value_type_allocator::reference reference;
137 typedef typename value_type_allocator::const_reference const_reference;
139 struct stored_value_type
141 value_type m_value;
144 static null_mapped_type s_null_mapped;
147 PB_DS_CLASS_T_DEC
148 null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
150 #undef PB_DS_CLASS_T_DEC
151 #undef PB_DS_CLASS_C_DEC
153 #define PB_DS_CLASS_T_DEC \
154 template<typename Key, typename Allocator>
156 #define PB_DS_CLASS_C_DEC \
157 value_type_base<Key, null_mapped_type, Allocator, true>
160 * Specialization of value_type_base for the case where the hash value
161 * is stored alongside each value.
163 template<typename Key, typename Allocator>
164 struct value_type_base<Key, null_mapped_type, Allocator, true>
166 typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
167 typedef typename mapped_type_allocator::value_type mapped_type;
168 typedef typename mapped_type_allocator::pointer mapped_pointer;
169 typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
170 typedef typename mapped_type_allocator::reference mapped_reference;
171 typedef typename mapped_type_allocator::const_reference const_mapped_reference;
173 typedef Key value_type;
175 typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
176 typedef typename value_type_allocator::pointer pointer;
177 typedef typename value_type_allocator::const_pointer const_pointer;
178 typedef typename value_type_allocator::reference reference;
179 typedef typename value_type_allocator::const_reference const_reference;
181 struct stored_value_type
183 value_type m_value;
184 typename Allocator::size_type m_hash;
187 static null_mapped_type s_null_mapped;
190 PB_DS_CLASS_T_DEC
191 null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
193 #undef PB_DS_CLASS_T_DEC
194 #undef PB_DS_CLASS_C_DEC
196 template<typename Key, typename Mapped>
197 struct no_throw_copies
199 typedef integral_constant<int, is_simple<Key>::value && is_simple<Mapped>::value> indicator;
202 template<typename Key>
203 struct no_throw_copies<Key, null_mapped_type>
205 typedef integral_constant<int, is_simple<Key>::value> indicator;
207 } // namespace detail
208 } // namespace __gnu_pbds
210 #endif