Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libstdc++-v3 / include / ext / pb_assoc / detail / standard_policies.hpp
blobac94a7de9d73d6ce463c87aac9ff5701d405b4d4
1 // -*- C++ -*-
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.
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.
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.
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.
30 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
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.
40 /**
41 * @file standard_policies.hpp
42 * Contains standard policies for containers.
45 #ifndef STANDARD_POLICIES_HPP
46 #define STANDARD_POLICIES_HPP
48 #include <memory>
49 #include <ext/pb_assoc/hash_policy.hpp>
50 #include <ext/pb_assoc/lu_policy.hpp>
51 #include <ext/pb_assoc/tree_policy.hpp>
52 #if defined(__GNUC__)
53 #include <ext/hash_map>
54 #elif defined(_MSC_VER)
55 #include <hash_map>
56 #else
57 #error "Unable to determine the namespaces for your compiler. Please" \
58 "Contact pbassoc@gmail.com"
59 #endif // #if defined(__GNUC__)
61 namespace pb_assoc
64 namespace detail
67 #ifdef __GNUC__
69 #define PB_ASSOC_HASH_NAMESPACE \
70 __gnu_cxx
72 template<typename Key>
73 struct def_hash_fn
75 typedef PB_ASSOC_HASH_NAMESPACE::hash<Key> type;
78 template<typename Key>
79 struct def_eq_fn
81 typedef PB_ASSOC_HASH_NAMESPACE::equal_to<Key> type;
84 #elif defined(_MSC_VER)
86 template<typename Key>
87 struct hash_value_class_adapter
89 inline size_t
90 operator()(const Key& r_key) const
92 return (stdext::hash_value(r_key));
96 template<typename Key>
97 struct def_hash_fn
99 typedef hash_value_class_adapter<Key> type;
102 template<typename Key>
103 struct def_eq_fn
105 typedef std::equal_to<Key> type;
108 #else // #elif defined(_MSC_VER)
110 #error Sorry, cannot determine headers, namespaces, etc. for your compiler.
111 #error If you encounter this error, pls write to pbassoc@gmail.com
113 #endif // #elif defined(_MSC_VER)
115 enum
117 def_store_hash = false
120 struct def_comb_hash_fn
122 typedef pb_assoc::direct_mask_range_hashing<> type;
125 template<class Comb_Hash_Fn>
126 struct def_resize_policy
128 private:
129 typedef typename Comb_Hash_Fn::size_type size_type;
131 typedef
132 typename pb_assoc::detail::cond_type<
133 pb_assoc::detail::is_same_type<
134 pb_assoc::direct_mask_range_hashing<size_type>,
135 Comb_Hash_Fn>::value,
136 pb_assoc::hash_exponential_size_policy<
137 size_type>,
138 pb_assoc::hash_prime_size_policy>::type
139 size_policy_type;
141 public:
142 typedef
143 pb_assoc::hash_standard_resize_policy<
144 size_policy_type,
145 pb_assoc::hash_load_check_resize_trigger<
146 false,
147 size_type>,
148 false,
149 size_type>
150 type;
153 struct def_update_policy
155 typedef pb_assoc::move_to_front_lu_policy<> type;
158 #ifdef __GNUC__
159 #undef PB_ASSOC_HASH_NAMESPACE
160 #endif // #ifdef __GNUC__
162 template<class Comb_Probe_Fn>
163 struct def_probe_fn
165 private:
166 typedef typename Comb_Probe_Fn::size_type size_type;
168 public:
169 typedef
170 typename pb_assoc::detail::cond_type<
171 pb_assoc::detail::is_same_type<
172 pb_assoc::direct_mask_range_hashing<size_t>,
173 Comb_Probe_Fn>::value,
174 pb_assoc::linear_probe_fn<
175 size_type>,
176 pb_assoc::quadratic_probe_fn<
177 size_type> >::type
178 type;
181 typedef pb_assoc::null_node_updator def_node_updator;
183 } // namespace detail
185 } // namespace pb_assoc
187 #endif // #ifndef STANDARD_POLICIES_HPP