00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef PB_DS_STANDARD_POLICIES_HPP
00048 #define PB_DS_STANDARD_POLICIES_HPP
00049
00050 #include <memory>
00051 #include <ext/pb_ds/hash_policy.hpp>
00052 #include <ext/pb_ds/list_update_policy.hpp>
00053 #include <ext/pb_ds/tree_policy.hpp>
00054 #include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
00055 #include <ext/pb_ds/trie_policy.hpp>
00056 #include <ext/pb_ds/tag_and_trait.hpp>
00057 #include <ext/hash_map>
00058
00059 namespace pb_ds
00060 {
00061 namespace detail
00062 {
00063 template<typename Key>
00064 struct default_hash_fn
00065 {
00066 typedef __gnu_cxx::hash< Key> type;
00067 };
00068
00069 template<typename Key>
00070 struct default_eq_fn
00071 {
00072 typedef std::equal_to< Key> type;
00073 };
00074
00075 enum
00076 {
00077 default_store_hash = false
00078 };
00079
00080 struct default_comb_hash_fn
00081 {
00082 typedef pb_ds::direct_mask_range_hashing<> type;
00083 };
00084
00085 template<typename Comb_Hash_Fn>
00086 struct default_resize_policy
00087 {
00088 private:
00089 typedef typename Comb_Hash_Fn::size_type size_type;
00090
00091 typedef
00092 typename __conditional_type<
00093 is_same<
00094 pb_ds::direct_mask_range_hashing<
00095 size_type>,
00096 Comb_Hash_Fn>::value,
00097 pb_ds::hash_exponential_size_policy<
00098 size_type>,
00099 pb_ds::hash_prime_size_policy>::__type
00100 size_policy_type;
00101
00102 public:
00103 typedef
00104 pb_ds::hash_standard_resize_policy<
00105 size_policy_type,
00106 pb_ds::hash_load_check_resize_trigger<
00107 false,
00108 size_type>,
00109 false,
00110 size_type>
00111 type;
00112 };
00113
00114 struct default_update_policy
00115 {
00116 typedef pb_ds::move_to_front_lu_policy<> type;
00117 };
00118
00119 template<typename Comb_Probe_Fn>
00120 struct default_probe_fn
00121 {
00122 private:
00123 typedef typename Comb_Probe_Fn::size_type size_type;
00124
00125 public:
00126 typedef
00127 typename __conditional_type<
00128 is_same<
00129 pb_ds::direct_mask_range_hashing<size_t>,
00130 Comb_Probe_Fn>::value,
00131 pb_ds::linear_probe_fn<
00132 size_type>,
00133 pb_ds::quadratic_probe_fn<
00134 size_type> >::__type
00135 type;
00136 };
00137
00138 template<typename Key>
00139 struct default_trie_e_access_traits;
00140
00141 template<typename Char, class Char_Traits>
00142 struct default_trie_e_access_traits<
00143 std::basic_string<
00144 Char,
00145 Char_Traits,
00146 std::allocator<
00147 char> > >
00148 {
00149 typedef
00150 pb_ds::string_trie_e_access_traits<
00151 std::basic_string<
00152 Char,
00153 Char_Traits,
00154 std::allocator<
00155 char> > >
00156 type;
00157 };
00158
00159 }
00160 }
00161
00162 #endif // #ifndef PB_DS_STANDARD_POLICIES_HPP
00163