52 #ifdef PB_DS_HT_MAP_TRACE_
61 #ifdef PB_DS_DATA_TRUE_INDICATOR
62 #define PB_DS_CC_HASH_NAME cc_ht_map
65 #ifdef PB_DS_DATA_FALSE_INDICATOR
66 #define PB_DS_CC_HASH_NAME cc_ht_set
69 #define PB_DS_CLASS_T_DEC \
70 template<typename Key, typename Mapped, typename Hash_Fn, \
71 typename Eq_Fn, typename _Alloc, bool Store_Hash, \
72 typename Comb_Hash_Fn, typename Resize_Policy>
74 #define PB_DS_CLASS_C_DEC \
75 PB_DS_CC_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \
76 Store_Hash, Comb_Hash_Fn, Resize_Policy>
78 #define PB_DS_HASH_EQ_FN_C_DEC \
79 hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>
81 #define PB_DS_RANGED_HASH_FN_C_DEC \
82 ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, Store_Hash>
84 #define PB_DS_CC_HASH_TRAITS_BASE \
85 types_traits<Key, Mapped, _Alloc, Store_Hash>
88 #define PB_DS_DEBUG_MAP_BASE_C_DEC \
89 debug_map_base<Key, Eq_Fn, \
90 typename _Alloc::template rebind<Key>::other::const_reference>
131 template<
typename Key,
137 typename Comb_Hash_Fn,
138 typename Resize_Policy >
140 #ifdef _GLIBCXX_DEBUG
141 protected PB_DS_DEBUG_MAP_BASE_C_DEC,
144 public Resize_Policy,
157 struct entry :
public traits_base::stored_data_type
159 typename _Alloc::template rebind<entry>::other::pointer
m_p_next;
177 #ifdef _GLIBCXX_DEBUG
178 typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
181 #define PB_DS_GEN_POS std::pair<entry_pointer, typename _Alloc::size_type>
216 typedef typename traits_base::pointer
pointer;
221 #ifdef PB_DS_DATA_TRUE_INDICATOR
225 #ifdef PB_DS_DATA_FALSE_INDICATOR
231 #ifdef PB_DS_DATA_TRUE_INDICATOR
235 #ifdef PB_DS_DATA_FALSE_INDICATOR
250 const Resize_Policy&);
260 template<
typename It>
309 inline std::pair<point_iterator, bool>
311 {
return insert_imp(r_val, traits_base::m_store_extra_indicator); }
316 #ifdef PB_DS_DATA_TRUE_INDICATOR
317 return (subscript_imp(r_key, traits_base::m_store_extra_indicator));
320 return traits_base::s_null_type;
324 inline point_iterator
330 inline point_iterator
339 template<
typename Pred>
358 #ifdef _GLIBCXX_DEBUG
360 assert_valid(
const char*,
int)
const;
363 #ifdef PB_DS_HT_MAP_TRACE_
409 #ifdef PB_DS_DATA_TRUE_INDICATOR
414 const size_type pos = ranged_hash_fn_base::operator()(r_key);
416 resize_base::notify_insert_search_start();
419 && !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))
421 resize_base::notify_insert_search_collision();
425 resize_base::notify_insert_search_end();
429 return (p_e->m_value.second);
440 comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
442 resize_base::notify_insert_search_start();
444 !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash,
445 r_key, pos_hash_pair.second))
447 resize_base::notify_insert_search_collision();
451 resize_base::notify_insert_search_end();
455 return p_e->m_value.second;
460 pos_hash_pair)->second;
464 inline std::pair<point_iterator, bool>
467 inline std::pair<point_iterator, bool>
474 pos = ranged_hash_fn_base::operator()(
PB_DS_V2F(r_val));
478 traits_base::m_no_throw_copies_indicator);
487 return &p_e->m_value;
495 r_pos_hash_pair = ranged_hash_fn_base::operator()(
PB_DS_V2F(r_val));
498 traits_base::m_no_throw_copies_indicator);
501 p_e->m_hash = r_pos_hash_pair.second;
502 p_e->m_p_next =
m_entries[r_pos_hash_pair.first];
507 return &p_e->m_value;
514 resize_base::notify_find_search_start();
516 !hash_eq_fn_base::operator()(
PB_DS_V2F(p_e->m_value), r_key))
518 resize_base::notify_find_search_collision();
522 resize_base::notify_find_search_end();
524 #ifdef _GLIBCXX_DEBUG
530 return &p_e->m_value;
536 comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
538 resize_base::notify_find_search_start();
540 !hash_eq_fn_base::operator()(
PB_DS_V2F(p_e->m_value),
542 r_key, pos_hash_pair.second))
544 resize_base::notify_find_search_collision();
548 resize_base::notify_find_search_end();
550 #ifdef _GLIBCXX_DEBUG
556 return &p_e->m_value;
568 #ifdef PB_DS_DATA_TRUE_INDICATOR
571 std::pair<entry_pointer, size_type>& r_pos)
const
579 std::pair<entry_pointer, size_type>& r_pos)
const
582 r_pos.first = r_pos.first->m_p_next;
583 if (r_pos.first != 0)
585 r_p_value = &r_pos.first->m_value;
589 for (++r_pos.second; r_pos.second <
m_num_e; ++r_pos.second)
593 r_p_value = &r_pos.first->m_value;
601 std::pair<entry_pointer, size_type>& r_pos)
const
603 for (r_pos.second = 0; r_pos.second <
m_num_e; ++r_pos.second)
607 r_p_value = &r_pos.first->m_value;
613 #ifdef _GLIBCXX_DEBUG
616 const char*,
int)
const;
620 const char*,
int)
const;
624 const char*,
int)
const;
627 #ifdef PB_DS_HT_MAP_TRACE_
633 #ifdef PB_DS_DATA_TRUE_INDICATOR
653 || !is_same<Hash_Fn, __gnu_pbds::null_type>::value
671 #undef PB_DS_CLASS_T_DEC
672 #undef PB_DS_CLASS_C_DEC
673 #undef PB_DS_HASH_EQ_FN_C_DEC
674 #undef PB_DS_RANGED_HASH_FN_C_DEC
675 #undef PB_DS_CC_HASH_TRAITS_BASE
676 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
677 #undef PB_DS_CC_HASH_NAME
_Alloc::size_type size_type
Definition: cc_ht_map_.hpp:192
Definition: cc_ht_map_.hpp:202
point_const_iterator_ point_const_iterator
Definition: cc_ht_map_.hpp:229
Eq_Fn eq_fn
Definition: cc_ht_map_.hpp:195
size_type max_size() const
Definition: cc_ht_map_.hpp:139
mapped_reference operator[](key_const_reference r_key)
Definition: cc_ht_map_.hpp:314
entry_pointer_allocator::pointer entry_pointer_array
Definition: cc_ht_map_.hpp:171
traits_base::key_pointer key_pointer
Definition: cc_ht_map_.hpp:206
void inc_it_state(const_pointer &r_p_value, std::pair< entry_pointer, size_type > &r_pos) const
Definition: cc_ht_map_.hpp:578
traits_base::key_const_pointer key_const_pointer
Definition: cc_ht_map_.hpp:207
traits_base::comp_hash comp_hash
Definition: cc_ht_map_.hpp:150
traits_base::key_const_reference key_const_reference
Definition: cc_ht_map_.hpp:209
traits_base::reference reference
Definition: cc_ht_map_.hpp:218
void swap(PB_DS_CLASS_C_DEC &)
Hash_Fn hash_fn
Definition: cc_ht_map_.hpp:194
void do_resize_if_needed_no_throw()
_Alloc::template rebind< entry >::other entry_allocator
Definition: cc_ht_map_.hpp:164
const_iterator_ const_iterator
Definition: cc_ht_map_.hpp:239
#define PB_DS_CC_HASH_TRAITS_BASE
Definition: cc_ht_map_.hpp:84
point_iterator find_end()
static entry_allocator s_entry_allocator
Definition: cc_ht_map_.hpp:639
entry_allocator::reference entry_reference
Definition: cc_ht_map_.hpp:167
void deallocate_links_in_list(entry_pointer)
#define PB_DS_HASH_EQ_FN_C_DEC
Definition: cc_ht_map_.hpp:78
entry_allocator::const_pointer const_entry_pointer
Definition: cc_ht_map_.hpp:166
pointer find_key_pointer(key_const_reference r_key, true_type)
Definition: cc_ht_map_.hpp:534
traits_base::mapped_const_reference mapped_const_reference
Definition: cc_ht_map_.hpp:214
PB_DS_CC_HASH_TRAITS_BASE traits_base
Definition: cc_ht_map_.hpp:149
entry_pointer resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, false_type)
#define _GLIBCXX_DEBUG_ASSERT(_Condition)
Definition: debug.h:61
traits_base::key_reference key_reference
Definition: cc_ht_map_.hpp:208
#define _GLIBCXX_DEBUG_ONLY(_Statement)
Definition: debug.h:63
traits_base::const_reference const_reference
Definition: cc_ht_map_.hpp:219
static point_const_iterator s_const_find_end_it
Definition: cc_ht_map_.hpp:644
static iterator s_end_it
Definition: cc_ht_map_.hpp:641
bool empty() const
True if size() == 0.
Definition: cc_ht_map_.hpp:652
std::pair< point_iterator, bool > insert(const_reference r_val)
Definition: cc_ht_map_.hpp:310
void get_start_it_state(pointer &r_p_value, std::pair< entry_pointer, size_type > &r_pos) const
Definition: cc_ht_map_.hpp:600
static const_iterator s_const_end_it
Definition: cc_ht_map_.hpp:642
Resize_Policy resize_policy
Definition: cc_ht_map_.hpp:197
traits_base::pointer pointer_
Definition: cc_ht_map_.hpp:152
#define PB_DS_CLASS_C_DEC
Definition: cc_ht_map_.hpp:74
bool do_resize_if_needed()
void resize_imp_no_exceptions(size_type, entry_pointer_array, size_type)
void erase_entry_pointer(entry_pointer &)
static point_iterator s_find_end_it
Definition: cc_ht_map_.hpp:643
traits_base::const_pointer const_pointer
Definition: cc_ht_map_.hpp:217
cond_dealtor< entry, _Alloc > cond_dealtor_t
Definition: cc_ht_map_.hpp:162
return(unsigned int) __res
traits_base::value_type value_type_
Definition: cc_ht_map_.hpp:151
Definition: cc_ht_map_.hpp:157
PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base
Definition: cc_ht_map_.hpp:174
traits_base::mapped_const_pointer mapped_const_pointer
Definition: cc_ht_map_.hpp:212
bool erase(key_const_reference)
traits_base::const_pointer const_pointer_
Definition: cc_ht_map_.hpp:153
void rels_entry(entry_pointer)
traits_base::mapped_type mapped_type
Definition: cc_ht_map_.hpp:210
pointer find_key_pointer(key_const_reference r_key, false_type)
Definition: cc_ht_map_.hpp:511
_Alloc allocator_type
Definition: cc_ht_map_.hpp:191
_Alloc::template rebind< entry_pointer >::other entry_pointer_allocator
Definition: cc_ht_map_.hpp:170
traits_base::pointer pointer
Definition: cc_ht_map_.hpp:216
Comb_Hash_Fn comb_hash_fn
Definition: cc_ht_map_.hpp:196
Comb_Hash_Fn & get_comb_hash_fn()
Return current comb_hash_fn.
_Alloc::template rebind< entry >::other::pointer m_p_next
Definition: cc_ht_map_.hpp:159
point_iterator find(key_const_reference)
size_type m_num_used_e
Definition: cc_ht_map_.hpp:647
Const range-type iterator.
Definition: const_iterator.hpp:43
std::tr1::integral_constant< int, 1 > true_type
Definition: type_utils.hpp:70
traits_base::value_type value_type
Definition: cc_ht_map_.hpp:215
Conditional dey destructor, cc_hash.
Definition: cond_key_dtor_entry_dealtor.hpp:47
PB_DS_STATIC_ASSERT(sth, store_hash_ok)
Find type iterator.
Definition: point_iterator.hpp:43
traits_base::reference reference_
Definition: cc_ht_map_.hpp:154
#define PB_DS_CHECK_KEY_EXISTS(_Key)
Definition: container_base_dispatch.hpp:55
bool erase_in_pos_imp(key_const_reference, size_type)
size_type m_num_e
Definition: cc_ht_map_.hpp:646
traits_base::mapped_pointer mapped_pointer
Definition: cc_ht_map_.hpp:211
traits_base::const_reference const_reference_
Definition: cc_ht_map_.hpp:155
_Alloc::difference_type difference_type
Definition: cc_ht_map_.hpp:193
Range-type iterator.
Definition: iterator.hpp:43
std::pair< point_iterator, bool > insert_imp(const_reference, false_type)
void resize_imp(size_type)
#define PB_DS_RANGED_HASH_FN_C_DEC
Definition: cc_ht_map_.hpp:81
entry_allocator::pointer entry_pointer
Definition: cc_ht_map_.hpp:165
entry_pointer get_entry(const_reference, false_type)
entry_pointer_array m_entries
Definition: cc_ht_map_.hpp:648
void do_resize(size_type)
#define PB_DS_V2F(X)
Definition: container_base_dispatch.hpp:80
void copy_from_range(It, It)
PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base
Definition: cc_ht_map_.hpp:173
entry_allocator::const_reference const_entry_reference
Definition: cc_ht_map_.hpp:168
Const point-type iterator.
Definition: point_const_iterator.hpp:45
Resize_Policy resize_base
Definition: cc_ht_map_.hpp:175
virtual ~PB_DS_CC_HASH_NAME()
pointer insert_new_imp(const_reference r_val, size_type pos)
Definition: cc_ht_map_.hpp:471
pointer insert_new_imp(const_reference r_val, comp_hash &r_pos_hash_pair)
Definition: cc_ht_map_.hpp:491
Hash_Fn & get_hash_fn()
Return current hash_fn.
static entry_pointer_allocator s_entry_pointer_allocator
Definition: cc_ht_map_.hpp:640
traits_base::key_type key_type
Definition: cc_ht_map_.hpp:205
Resize_Policy & get_resize_policy()
Return current resize_policy.
#define PB_DS_CHECK_KEY_DOES_NOT_EXIST(_Key)
Definition: container_base_dispatch.hpp:58
traits_base::mapped_reference mapped_reference
Definition: cc_ht_map_.hpp:213
Eq_Fn & get_eq_fn()
Return current eq_fn.
std::tr1::integral_constant< int, 0 > false_type
Definition: type_utils.hpp:71