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 / eq_fn / hash_eq_fn.hpp
blobb21c252e2c049213dc3873c860de068805fffcce
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 hash_eq_fn.hpp
38 * Contains 2 eqivalence functions, one employing a hash value,
39 * and one ignoring it.
42 #ifndef PB_DS_HASH_EQ_FN_HPP
43 #define PB_DS_HASH_EQ_FN_HPP
45 #include <utility>
46 #include <debug/debug.h>
48 namespace __gnu_pbds
50 namespace detail
52 template<typename Key, class Eq_Fn, class Allocator, bool Store_Hash>
53 struct hash_eq_fn;
55 #define PB_DS_CLASS_T_DEC \
56 template<typename Key, class Eq_Fn, class Allocator>
58 #define PB_DS_CLASS_C_DEC \
59 hash_eq_fn<Key, Eq_Fn, Allocator, false>
61 /**
62 * Specialization 1- The client requests that hash values not be stored.
63 **/
64 template<typename Key, class Eq_Fn, class Allocator>
65 struct hash_eq_fn<Key, Eq_Fn, Allocator, false> : public Eq_Fn
67 typedef Eq_Fn eq_fn_base;
69 typedef typename Allocator::template rebind<Key>::other key_allocator;
71 typedef typename key_allocator::const_reference const_key_reference;
73 hash_eq_fn();
75 hash_eq_fn(const Eq_Fn& r_eq_fn);
77 inline bool
78 operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
80 inline void
81 swap(const PB_DS_CLASS_C_DEC& other);
84 PB_DS_CLASS_T_DEC
85 PB_DS_CLASS_C_DEC::
86 hash_eq_fn()
87 { }
89 PB_DS_CLASS_T_DEC
90 inline void
91 PB_DS_CLASS_C_DEC::
92 swap(const PB_DS_CLASS_C_DEC& other)
93 { std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); }
95 PB_DS_CLASS_T_DEC
96 PB_DS_CLASS_C_DEC::
97 hash_eq_fn(const Eq_Fn& r_eq_fn) :
98 Eq_Fn(r_eq_fn)
99 { }
101 PB_DS_CLASS_T_DEC
102 inline bool
103 PB_DS_CLASS_C_DEC::
104 operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
105 { return (eq_fn_base::operator()(r_lhs_key, r_rhs_key)); }
107 #undef PB_DS_CLASS_T_DEC
108 #undef PB_DS_CLASS_C_DEC
110 #define PB_DS_CLASS_T_DEC \
111 template<typename Key, class Eq_Fn, class Allocator>
113 #define PB_DS_CLASS_C_DEC \
114 hash_eq_fn<Key, Eq_Fn, Allocator, true>
117 * Specialization 2- The client requests that hash values be stored.
119 template<typename Key, class Eq_Fn, class Allocator>
120 struct hash_eq_fn<Key, Eq_Fn, Allocator, true> :
121 public Eq_Fn
123 typedef typename Allocator::size_type size_type;
125 typedef Eq_Fn eq_fn_base;
127 typedef typename Allocator::template rebind<Key>::other key_allocator;
129 typedef typename key_allocator::const_reference const_key_reference;
131 hash_eq_fn();
133 hash_eq_fn(const Eq_Fn& r_eq_fn);
135 inline bool
136 operator()(const_key_reference r_lhs_key, size_type lhs_hash,
137 const_key_reference r_rhs_key, size_type rhs_hash) const;
139 inline void
140 swap(const PB_DS_CLASS_C_DEC& other);
143 PB_DS_CLASS_T_DEC
144 PB_DS_CLASS_C_DEC::
145 hash_eq_fn()
148 PB_DS_CLASS_T_DEC
149 PB_DS_CLASS_C_DEC::
150 hash_eq_fn(const Eq_Fn& r_eq_fn) :
151 Eq_Fn(r_eq_fn)
154 PB_DS_CLASS_T_DEC
155 inline bool
156 PB_DS_CLASS_C_DEC::
157 operator()(const_key_reference r_lhs_key, size_type lhs_hash,
158 const_key_reference r_rhs_key, size_type rhs_hash) const
160 _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key)
161 || lhs_hash == rhs_hash);
163 return (lhs_hash == rhs_hash &&
164 eq_fn_base::operator()(r_lhs_key, r_rhs_key));
167 PB_DS_CLASS_T_DEC
168 inline void
169 PB_DS_CLASS_C_DEC::
170 swap(const PB_DS_CLASS_C_DEC& other)
171 { std::swap((Eq_Fn& )(*this), (Eq_Fn& )(other)); }
173 #undef PB_DS_CLASS_T_DEC
174 #undef PB_DS_CLASS_C_DEC
176 } // namespace detail
177 } // namespace __gnu_pbds
179 #endif