Commit 551fe1a2 by Benjamin Kosnik

re PR libstdc++/29367 (pb_ds hash containers vs. _GLIBCXX_DEBUG)

2007-09-06  Benjamin Kosnik  <bkoz@redhat.com>
	
	PR libstdc++/29367
	* include/ext/pb_ds/detail/map_debug_base.hpp: From this..
	* include/ext/pb_ds/detail/debug_map_base.hpp: ...to this.
	Rename map_debug_base to debug_map_base, add std::pair output
	extractors, change duplicate map_debug_base typedef in containers
	to debug_base. Use m_store_extra_indicator for m_store_hash_indicator.
	* include/ext/pb_ds/*: Likewise.
	* include/Makefile.am: Same.
	* include/Makefile.in: Regenerate.

From-SVN: r128221
parent ccd04b9f
...@@ -372,7 +372,7 @@ pb_headers4 = \ ...@@ -372,7 +372,7 @@ pb_headers4 = \
${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \ ${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \
${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \ ${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \
${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \ ${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \
${pb_srcdir}/detail/map_debug_base.hpp \ ${pb_srcdir}/detail/debug_map_base.hpp \
${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \ ${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \
${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \
......
...@@ -616,7 +616,7 @@ pb_headers4 = \ ...@@ -616,7 +616,7 @@ pb_headers4 = \
${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \ ${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \
${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \ ${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \
${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \ ${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \
${pb_srcdir}/detail/map_debug_base.hpp \ ${pb_srcdir}/detail/debug_map_base.hpp \
${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \ ${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \
${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp> #include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
#include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/detail/map_debug_base.hpp> #include <ext/pb_ds/detail/debug_map_base.hpp>
#include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/type_utils.hpp>
...@@ -95,8 +95,8 @@ namespace pb_ds ...@@ -95,8 +95,8 @@ namespace pb_ds
false> false>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#define PB_DS_MAP_DEBUG_BASE_C_DEC \ #define PB_DS_DEBUG_MAP_BASE_C_DEC \
map_debug_base<Key, eq_by_less<Key, Cmp_Fn>, \ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
typename Allocator::template rebind<Key>::other::const_reference> typename Allocator::template rebind<Key>::other::const_reference>
#endif #endif
...@@ -132,7 +132,7 @@ namespace pb_ds ...@@ -132,7 +132,7 @@ namespace pb_ds
class Allocator> class Allocator>
class PB_DS_CLASS_NAME : class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
public PB_DS_MAP_DEBUG_BASE_C_DEC, public PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif #endif
#ifdef PB_DS_TREE_TRACE #ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC, public PB_DS_TREE_TRACE_BASE_C_DEC,
...@@ -162,7 +162,7 @@ namespace pb_ds ...@@ -162,7 +162,7 @@ namespace pb_ds
typedef cond_dealtor< node, Allocator> cond_dealtor_t; typedef cond_dealtor< node, Allocator> cond_dealtor_t;
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base; typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif #endif
public: public:
...@@ -489,7 +489,7 @@ namespace pb_ds ...@@ -489,7 +489,7 @@ namespace pb_ds
#undef PB_DS_TYPES_TRAITS_C_DEC #undef PB_DS_TYPES_TRAITS_C_DEC
#undef PB_DS_MAP_DEBUG_BASE_C_DEC #undef PB_DS_DEBUG_MAP_BASE_C_DEC
#ifdef PB_DS_TREE_TRACE #ifdef PB_DS_TREE_TRACE
#undef PB_DS_TREE_TRACE_BASE_C_DEC #undef PB_DS_TREE_TRACE_BASE_C_DEC
......
...@@ -81,7 +81,7 @@ PB_DS_CLASS_T_DEC ...@@ -81,7 +81,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
map_debug_base(other), debug_base(other),
#endif #endif
#ifdef PB_DS_TREE_TRACE #ifdef PB_DS_TREE_TRACE
PB_DS_TREE_TRACE_BASE_C_DEC(other), PB_DS_TREE_TRACE_BASE_C_DEC(other),
...@@ -105,7 +105,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : ...@@ -105,7 +105,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
} }
catch(...) catch(...)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear();) _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
s_node_allocator.deallocate(m_p_head, 1); s_node_allocator.deallocate(m_p_head, 1);
__throw_exception_again; __throw_exception_again;
} }
...@@ -130,7 +130,7 @@ void ...@@ -130,7 +130,7 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other) value_swap(PB_DS_CLASS_C_DEC& other)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);) _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_p_head, other.m_p_head); std::swap(m_p_head, other.m_p_head);
std::swap(m_size, other.m_size); std::swap(m_size, other.m_size);
} }
......
...@@ -251,7 +251,7 @@ void ...@@ -251,7 +251,7 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
assert_consistent_with_debug_base() const assert_consistent_with_debug_base() const
{ {
map_debug_base::check_size(m_size); debug_base::check_size(m_size);
assert_consistent_with_debug_base(m_p_head->m_p_parent); assert_consistent_with_debug_base(m_p_head->m_p_parent);
} }
...@@ -262,7 +262,7 @@ assert_consistent_with_debug_base(const node_pointer p_nd) const ...@@ -262,7 +262,7 @@ assert_consistent_with_debug_base(const node_pointer p_nd) const
{ {
if (p_nd == NULL) if (p_nd == NULL)
return; return;
map_debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value)); debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value));
assert_consistent_with_debug_base(p_nd->m_p_left); assert_consistent_with_debug_base(p_nd->m_p_left);
assert_consistent_with_debug_base(p_nd->m_p_right); assert_consistent_with_debug_base(p_nd->m_p_right);
} }
......
...@@ -102,7 +102,7 @@ clear() ...@@ -102,7 +102,7 @@ clear()
initialize(); initialize();
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear();) _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();) _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
} }
......
...@@ -82,13 +82,13 @@ insert_leaf(const_reference r_value) ...@@ -82,13 +82,13 @@ insert_leaf(const_reference r_value)
{ {
_GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();) _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists( _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(
PB_DS_V2F(r_value))); PB_DS_V2F(r_value)));
return (std::make_pair(p_pot, false)); return (std::make_pair(p_pot, false));
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist( _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(
PB_DS_V2F(r_value))); PB_DS_V2F(r_value)));
p_nd = p_pot->m_p_left; p_nd = p_pot->m_p_left;
...@@ -146,7 +146,7 @@ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd) ...@@ -146,7 +146,7 @@ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
update_to_top(p_new_nd, (node_update* )this); update_to_top(p_new_nd, (node_update* )this);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new( _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(
PB_DS_V2F(r_value))); PB_DS_V2F(r_value)));
return (iterator(p_new_nd)); return (iterator(p_new_nd));
...@@ -167,7 +167,7 @@ insert_imp_empty(const_reference r_value) ...@@ -167,7 +167,7 @@ insert_imp_empty(const_reference r_value)
p_new_node->m_p_left = p_new_node->m_p_right = NULL; p_new_node->m_p_left = p_new_node->m_p_right = NULL;
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new( _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(
PB_DS_V2F(r_value))); PB_DS_V2F(r_value)));
update_to_top(m_p_head->m_p_parent, (node_update* )this); update_to_top(m_p_head->m_p_parent, (node_update* )this);
......
...@@ -102,7 +102,7 @@ clear() ...@@ -102,7 +102,7 @@ clear()
initialize(); initialize();
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear();) _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();) _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
} }
......
...@@ -71,7 +71,7 @@ join_prep(PB_DS_CLASS_C_DEC& other) ...@@ -71,7 +71,7 @@ join_prep(PB_DS_CLASS_C_DEC& other)
value_swap(other); value_swap(other);
m_size += other.m_size; m_size += other.m_size;
_GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);) _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
return true; return true;
} }
...@@ -123,7 +123,7 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other) ...@@ -123,7 +123,7 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
return false; return false;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::split(r_key,(Cmp_Fn& )(*this), other);) _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);)
return true; return true;
} }
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp> #include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/map_debug_base.hpp> #include <ext/pb_ds/detail/debug_map_base.hpp>
#endif #endif
#ifdef PB_DS_HT_MAP_TRACE_ #ifdef PB_DS_HT_MAP_TRACE_
#include <iostream> #include <iostream>
...@@ -92,8 +92,8 @@ namespace pb_ds ...@@ -92,8 +92,8 @@ namespace pb_ds
types_traits<Key, Mapped, Allocator, Store_Hash> types_traits<Key, Mapped, Allocator, Store_Hash>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#define PB_DS_MAP_DEBUG_BASE_C_DEC \ #define PB_DS_DEBUG_MAP_BASE_C_DEC \
map_debug_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference> debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
#endif #endif
#ifdef PB_DS_DATA_TRUE_INDICATOR #ifdef PB_DS_DATA_TRUE_INDICATOR
...@@ -117,7 +117,7 @@ namespace pb_ds ...@@ -117,7 +117,7 @@ namespace pb_ds
typename Resize_Policy > typename Resize_Policy >
class PB_DS_CLASS_NAME: class PB_DS_CLASS_NAME:
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
protected PB_DS_MAP_DEBUG_BASE_C_DEC, protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif #endif
public PB_DS_HASH_EQ_FN_C_DEC, public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy, public Resize_Policy,
...@@ -154,7 +154,7 @@ namespace pb_ds ...@@ -154,7 +154,7 @@ namespace pb_ds
typedef Resize_Policy resize_base; typedef Resize_Policy resize_base;
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base; typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif #endif
#define PB_DS_GEN_POS std::pair<entry_pointer, typename Allocator::size_type> #define PB_DS_GEN_POS std::pair<entry_pointer, typename Allocator::size_type>
...@@ -390,11 +390,11 @@ namespace pb_ds ...@@ -390,11 +390,11 @@ namespace pb_ds
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
if (p_e != NULL) if (p_e != NULL)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return (p_e->m_value.second); return (p_e->m_value.second);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return insert_new_imp(value_type(r_key, mapped_type()), pos)->second; return insert_new_imp(value_type(r_key, mapped_type()), pos)->second;
} }
...@@ -415,11 +415,11 @@ namespace pb_ds ...@@ -415,11 +415,11 @@ namespace pb_ds
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
if (p_e != NULL) if (p_e != NULL)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return p_e->m_value.second; return p_e->m_value.second;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return insert_new_imp(value_type(r_key, mapped_type()), return insert_new_imp(value_type(r_key, mapped_type()),
pos_hash_pair)->second; pos_hash_pair)->second;
} }
...@@ -445,7 +445,7 @@ namespace pb_ds ...@@ -445,7 +445,7 @@ namespace pb_ds
m_entries[pos] = p_e; m_entries[pos] = p_e;
resize_base::notify_inserted(++m_num_used_e); resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return &p_e->m_value; return &p_e->m_value;
} }
...@@ -464,7 +464,7 @@ namespace pb_ds ...@@ -464,7 +464,7 @@ namespace pb_ds
p_e->m_p_next = m_entries[r_pos_hash_pair.first]; p_e->m_p_next = m_entries[r_pos_hash_pair.first];
m_entries[r_pos_hash_pair.first] = p_e; m_entries[r_pos_hash_pair.first] = p_e;
resize_base::notify_inserted(++m_num_used_e); resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return &p_e->m_value; return &p_e->m_value;
} }
...@@ -485,9 +485,9 @@ namespace pb_ds ...@@ -485,9 +485,9 @@ namespace pb_ds
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
if (p_e == NULL) if (p_e == NULL)
map_debug_base::check_key_does_not_exist(r_key); debug_base::check_key_does_not_exist(r_key);
else else
map_debug_base::check_key_exists(r_key); debug_base::check_key_exists(r_key);
#endif #endif
return &p_e->m_value; return &p_e->m_value;
} }
...@@ -511,9 +511,9 @@ namespace pb_ds ...@@ -511,9 +511,9 @@ namespace pb_ds
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
if (p_e == NULL) if (p_e == NULL)
map_debug_base::check_key_does_not_exist(r_key); debug_base::check_key_does_not_exist(r_key);
else else
map_debug_base::check_key_exists(r_key); debug_base::check_key_exists(r_key);
#endif #endif
return &p_e->m_value; return &p_e->m_value;
} }
...@@ -632,7 +632,7 @@ namespace pb_ds ...@@ -632,7 +632,7 @@ namespace pb_ds
#undef PB_DS_HASH_EQ_FN_C_DEC #undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_HASH_FN_C_DEC #undef PB_DS_RANGED_HASH_FN_C_DEC
#undef PB_DS_TYPES_TRAITS_C_DEC #undef PB_DS_TYPES_TRAITS_C_DEC
#undef PB_DS_MAP_DEBUG_BASE_C_DEC #undef PB_DS_DEBUG_MAP_BASE_C_DEC
#undef PB_DS_CLASS_NAME #undef PB_DS_CLASS_NAME
#undef PB_DS_V2F #undef PB_DS_V2F
#undef PB_DS_V2S #undef PB_DS_V2S
......
...@@ -68,7 +68,7 @@ cmp_with_other(const Other_Map_Type& other) const ...@@ -68,7 +68,7 @@ cmp_with_other(const Other_Map_Type& other) const
const_mapped_pointer p_mapped_value = const_mapped_pointer p_mapped_value =
const_cast<PB_DS_CLASS_C_DEC& >(*this). const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_hash_indicator); find_key_pointer(r_key, traits_base::m_store_extra_indicator);
if (p_mapped_value == NULL) if (p_mapped_value == NULL)
return false; return false;
......
...@@ -130,7 +130,7 @@ PB_DS_CLASS_T_DEC ...@@ -130,7 +130,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
map_debug_base(other), debug_base(other),
#endif #endif
PB_DS_HASH_EQ_FN_C_DEC(other), PB_DS_HASH_EQ_FN_C_DEC(other),
resize_base(other), ranged_hash_fn_base(other), resize_base(other), ranged_hash_fn_base(other),
...@@ -171,7 +171,7 @@ swap(PB_DS_CLASS_C_DEC& other) ...@@ -171,7 +171,7 @@ swap(PB_DS_CLASS_C_DEC& other)
hash_eq_fn_base::swap(other); hash_eq_fn_base::swap(other);
resize_base::swap(other); resize_base::swap(other);
_GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other)); _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
_GLIBCXX_DEBUG_ONLY(assert_valid()); _GLIBCXX_DEBUG_ONLY(assert_valid());
_GLIBCXX_DEBUG_ONLY(other.assert_valid()); _GLIBCXX_DEBUG_ONLY(other.assert_valid());
} }
......
...@@ -57,5 +57,5 @@ constructor_insert_new_imp(const_mapped_reference r_val, size_type pos, ...@@ -57,5 +57,5 @@ constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
// At this point no exceptions can be thrown. // At this point no exceptions can be thrown.
p->m_p_next = m_entries[pos]; p->m_p_next = m_entries[pos];
m_entries[pos] = p; m_entries[pos] = p;
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
} }
...@@ -58,5 +58,5 @@ constructor_insert_new_imp(const_reference r_val, size_type pos, true_type) ...@@ -58,5 +58,5 @@ constructor_insert_new_imp(const_reference r_val, size_type pos, true_type)
p->m_hash = ranged_hash_fn_base::operator()((const_key_reference)(PB_DS_V2F(p->m_value))).second; p->m_hash = ranged_hash_fn_base::operator()((const_key_reference)(PB_DS_V2F(p->m_value))).second;
m_entries[pos] = p; m_entries[pos] = p;
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
} }
...@@ -51,7 +51,7 @@ void ...@@ -51,7 +51,7 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
assert_valid() const assert_valid() const
{ {
map_debug_base::check_size(m_num_used_e); debug_base::check_size(m_num_used_e);
assert_entry_pointer_array_valid(m_entries); assert_entry_pointer_array_valid(m_entries);
} }
...@@ -67,7 +67,7 @@ assert_entry_pointer_array_valid(const entry_pointer_array a_p_entries) const ...@@ -67,7 +67,7 @@ assert_entry_pointer_array_valid(const entry_pointer_array a_p_entries) const
while (p_e != NULL) while (p_e != NULL)
{ {
++iterated_num_used_e; ++iterated_num_used_e;
assert_entry_pointer_valid(p_e, traits_base::m_store_hash_indicator); assert_entry_pointer_valid(p_e, traits_base::m_store_extra_indicator);
p_e = p_e->m_p_next; p_e = p_e->m_p_next;
} }
} }
......
...@@ -50,6 +50,6 @@ PB_DS_CLASS_T_DEC ...@@ -50,6 +50,6 @@ PB_DS_CLASS_T_DEC
void void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
assert_entry_pointer_valid(const entry_pointer p, false_type) const assert_entry_pointer_valid(const entry_pointer p, false_type) const
{ map_debug_base::check_key_exists(PB_DS_V2F(p->m_value)); } { debug_base::check_key_exists(PB_DS_V2F(p->m_value)); }
#endif #endif
...@@ -51,7 +51,7 @@ void ...@@ -51,7 +51,7 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
assert_entry_pointer_valid(const entry_pointer p_e, true_type) const assert_entry_pointer_valid(const entry_pointer p_e, true_type) const
{ {
map_debug_base::check_key_exists(PB_DS_V2F(p_e->m_value)); debug_base::check_key_exists(PB_DS_V2F(p_e->m_value));
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value)); comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));
_GLIBCXX_DEBUG_ASSERT(p_e->m_hash == pos_hash_pair.second); _GLIBCXX_DEBUG_ASSERT(p_e->m_hash == pos_hash_pair.second);
} }
......
...@@ -49,7 +49,7 @@ inline void ...@@ -49,7 +49,7 @@ inline void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
erase_entry_pointer(entry_pointer& r_p_e) erase_entry_pointer(entry_pointer& r_p_e)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::erase_existing(PB_DS_V2F(r_p_e->m_value))); _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(r_p_e->m_value)));
entry_pointer p_e = r_p_e; entry_pointer p_e = r_p_e;
r_p_e = r_p_e->m_p_next; r_p_e = r_p_e->m_p_next;
......
...@@ -65,7 +65,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos) ...@@ -65,7 +65,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos)
if (p_e == NULL) if (p_e == NULL)
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return false; return false;
} }
...@@ -73,7 +73,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos) ...@@ -73,7 +73,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos)
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base:: check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base:: check_key_exists(r_key);)
erase_entry_pointer(m_entries[pos]); erase_entry_pointer(m_entries[pos]);
do_resize_if_needed_no_throw(); do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
...@@ -86,7 +86,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos) ...@@ -86,7 +86,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos)
if (p_next_e == NULL) if (p_next_e == NULL)
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return false; return false;
} }
...@@ -94,7 +94,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos) ...@@ -94,7 +94,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos)
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key)) if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key))
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
erase_entry_pointer(p_e->m_p_next); erase_entry_pointer(p_e->m_p_next);
do_resize_if_needed_no_throw(); do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
......
...@@ -56,7 +56,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair) ...@@ -56,7 +56,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
if (p_e == NULL) if (p_e == NULL)
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base:: check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base:: check_key_does_not_exist(r_key);)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return false; return false;
} }
...@@ -65,7 +65,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair) ...@@ -65,7 +65,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
r_key, r_pos_hash_pair.second)) r_key, r_pos_hash_pair.second))
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
erase_entry_pointer(m_entries[r_pos_hash_pair.first]); erase_entry_pointer(m_entries[r_pos_hash_pair.first]);
do_resize_if_needed_no_throw(); do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
...@@ -78,7 +78,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair) ...@@ -78,7 +78,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
if (p_next_e == NULL) if (p_next_e == NULL)
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return false; return false;
} }
...@@ -88,7 +88,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair) ...@@ -88,7 +88,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
r_pos_hash_pair.second)) r_pos_hash_pair.second))
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
erase_entry_pointer(p_e->m_p_next); erase_entry_pointer(p_e->m_p_next);
do_resize_if_needed_no_throw(); do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
......
...@@ -85,7 +85,7 @@ cmp_with_other(const Other_Map_Type& other) const ...@@ -85,7 +85,7 @@ cmp_with_other(const Other_Map_Type& other) const
const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it); const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it);
const_mapped_pointer p_mapped_value = const_mapped_pointer p_mapped_value =
const_cast<PB_DS_CLASS_C_DEC& >(*this). const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_hash_indicator); find_key_pointer(r_key, traits_base::m_store_extra_indicator);
if (p_mapped_value == NULL) if (p_mapped_value == NULL)
return false; return false;
......
...@@ -66,11 +66,11 @@ insert_imp(const_reference r_val, false_type) ...@@ -66,11 +66,11 @@ insert_imp(const_reference r_val, false_type)
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
if (p_e != NULL) if (p_e != NULL)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return std::make_pair(&p_e->m_value, false); return std::make_pair(&p_e->m_value, false);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return std::make_pair(insert_new_imp(r_val, pos), true); return std::make_pair(insert_new_imp(r_val, pos), true);
} }
...@@ -67,11 +67,11 @@ insert_imp(const_reference r_val, true_type) ...@@ -67,11 +67,11 @@ insert_imp(const_reference r_val, true_type)
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
if (p_e != NULL) if (p_e != NULL)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
return std::make_pair(&p_e->m_value, false); return std::make_pair(&p_e->m_value, false);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true); return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
} }
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
// warranty. // warranty.
/** /**
* @file map_debug_base.hpp * @file debug_map_base.hpp
* Contains a debug-mode base for all maps. * Contains a debug-mode base for all maps.
*/ */
#ifndef PB_DS_MAP_DEBUG_BASE_HPP #ifndef PB_DS_DEBUG_MAP_BASE_HPP
#define PB_DS_MAP_DEBUG_BASE_HPP #define PB_DS_DEBUG_MAP_BASE_HPP
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
...@@ -59,15 +59,21 @@ namespace pb_ds ...@@ -59,15 +59,21 @@ namespace pb_ds
{ {
namespace detail namespace detail
{ {
// Need std::pair ostream extractor.
template<typename _CharT, typename _Traits, typename _Tp1, typename _Tp2>
inline std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __out,
const std::pair<_Tp1, _Tp2>& p)
{ return (__out << '(' << p.first << ',' << p.second << ')'); }
#define PB_DS_CLASS_T_DEC \ #define PB_DS_CLASS_T_DEC \
template<typename Key, class Eq_Fn, typename Const_Key_Reference> template<typename Key, class Eq_Fn, typename Const_Key_Reference>
#define PB_DS_CLASS_C_DEC \ #define PB_DS_CLASS_C_DEC \
map_debug_base<Key, Eq_Fn, Const_Key_Reference> debug_map_base<Key, Eq_Fn, Const_Key_Reference>
template<typename Key, class Eq_Fn, typename Const_Key_Reference> template<typename Key, class Eq_Fn, typename Const_Key_Reference>
class map_debug_base class debug_map_base
{ {
private: private:
typedef typename std::allocator< Key> key_allocator; typedef typename std::allocator< Key> key_allocator;
...@@ -77,11 +83,11 @@ namespace pb_ds ...@@ -77,11 +83,11 @@ namespace pb_ds
typedef Const_Key_Reference const_key_reference; typedef Const_Key_Reference const_key_reference;
protected: protected:
map_debug_base(); debug_map_base();
map_debug_base(const PB_DS_CLASS_C_DEC& other); debug_map_base(const PB_DS_CLASS_C_DEC& other);
~map_debug_base(); ~debug_map_base();
inline void inline void
insert_new(const_key_reference r_key); insert_new(const_key_reference r_key);
...@@ -133,17 +139,17 @@ namespace pb_ds ...@@ -133,17 +139,17 @@ namespace pb_ds
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
map_debug_base() debug_map_base()
{ _GLIBCXX_DEBUG_ONLY(assert_valid();) } { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
map_debug_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set) debug_map_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set)
{ _GLIBCXX_DEBUG_ONLY(assert_valid();) } { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
~map_debug_base() ~debug_map_base()
{ _GLIBCXX_DEBUG_ONLY(assert_valid();) } { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
...@@ -157,7 +163,7 @@ namespace pb_ds ...@@ -157,7 +163,7 @@ namespace pb_ds
alloc.set_throw_prob(0); alloc.set_throw_prob(0);
if (find(r_key) != m_key_set.end()) if (find(r_key) != m_key_set.end())
{ {
std::cerr << "insert_new " << r_key << std::endl; std::cerr << "insert_new" << r_key << std::endl;
std::abort(); std::abort();
} }
...@@ -167,7 +173,7 @@ namespace pb_ds ...@@ -167,7 +173,7 @@ namespace pb_ds
} }
catch(...) catch(...)
{ {
std::cerr << "insert_new 1" << r_key << std::endl; std::cerr << "insert_new" << r_key << std::endl;
std::abort(); std::abort();
} }
alloc.set_throw_prob(orig_throw_prob); alloc.set_throw_prob(orig_throw_prob);
...@@ -183,7 +189,7 @@ namespace pb_ds ...@@ -183,7 +189,7 @@ namespace pb_ds
key_set_iterator it = find(r_key); key_set_iterator it = find(r_key);
if (it == m_key_set.end()) if (it == m_key_set.end())
{ {
std::cerr << "erase_existing " << r_key << std::endl; std::cerr << "erase_existing" << r_key << std::endl;
std::abort(); std::abort();
} }
m_key_set.erase(it); m_key_set.erase(it);
...@@ -208,7 +214,7 @@ namespace pb_ds ...@@ -208,7 +214,7 @@ namespace pb_ds
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
if (find(r_key) == m_key_set.end()) if (find(r_key) == m_key_set.end())
{ {
std::cerr << "check_key_exists " << r_key << std::endl; std::cerr << "check_key_exists" << r_key << std::endl;
std::abort(); std::abort();
} }
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
...@@ -222,7 +228,9 @@ namespace pb_ds ...@@ -222,7 +228,9 @@ namespace pb_ds
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
if (find(r_key) != m_key_set.end()) if (find(r_key) != m_key_set.end())
{ {
std::cerr << "check_key_does_not_exist " << r_key << std::endl; using std::cerr;
using std::endl;
cerr << "check_key_does_not_exist" << r_key << endl;
std::abort(); std::abort();
} }
} }
......
...@@ -140,7 +140,7 @@ PB_DS_CLASS_T_DEC ...@@ -140,7 +140,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
map_debug_base(other), debug_base(other),
#endif #endif
hash_eq_fn_base(other), hash_eq_fn_base(other),
resize_base(other), resize_base(other),
...@@ -187,7 +187,7 @@ swap(PB_DS_CLASS_C_DEC& other) ...@@ -187,7 +187,7 @@ swap(PB_DS_CLASS_C_DEC& other)
ranged_probe_fn_base::swap(other); ranged_probe_fn_base::swap(other);
hash_eq_fn_base::swap(other); hash_eq_fn_base::swap(other);
resize_base::swap(other); resize_base::swap(other);
_GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other)); _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
_GLIBCXX_DEBUG_ONLY(assert_valid()); _GLIBCXX_DEBUG_ONLY(assert_valid());
_GLIBCXX_DEBUG_ONLY(other.assert_valid()); _GLIBCXX_DEBUG_ONLY(other.assert_valid());
} }
......
...@@ -55,5 +55,5 @@ constructor_insert_new_imp(const_mapped_reference r_val, size_type pos, ...@@ -55,5 +55,5 @@ constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
entry* const p_e = m_entries + pos; entry* const p_e = m_entries + pos;
new (&p_e->m_value) mapped_value_type(r_val); new (&p_e->m_value) mapped_value_type(r_val);
p_e->m_stat = valid_entry_status; p_e->m_stat = valid_entry_status;
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(p_e->m_value.first);) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)
} }
...@@ -56,5 +56,5 @@ constructor_insert_new_imp(const_mapped_reference r_val, size_type pos, ...@@ -56,5 +56,5 @@ constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
new (&p_e->m_value) mapped_value_type(r_val); new (&p_e->m_value) mapped_value_type(r_val);
p_e->m_hash = ranged_probe_fn_base::operator()(PB_DS_V2F(r_val)).second; p_e->m_hash = ranged_probe_fn_base::operator()(PB_DS_V2F(r_val)).second;
p_e->m_stat = valid_entry_status; p_e->m_stat = valid_entry_status;
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(p_e->m_value.first);) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)
} }
...@@ -51,7 +51,7 @@ void ...@@ -51,7 +51,7 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
assert_valid() const assert_valid() const
{ {
map_debug_base::check_size(m_num_used_e); debug_base::check_size(m_num_used_e);
assert_entry_array_valid(m_entries, traits_base::m_store_extra_indicator); assert_entry_array_valid(m_entries, traits_base::m_store_extra_indicator);
} }
......
...@@ -63,7 +63,7 @@ assert_entry_array_valid(const entry_array a_entries, false_type) const ...@@ -63,7 +63,7 @@ assert_entry_array_valid(const entry_array a_entries, false_type) const
case valid_entry_status: case valid_entry_status:
{ {
const_key_reference r_key = PB_DS_V2F(p_e->m_value); const_key_reference r_key = PB_DS_V2F(p_e->m_value);
map_debug_base::check_key_exists(r_key); debug_base::check_key_exists(r_key);
++iterated_num_used_e; ++iterated_num_used_e;
break; break;
} }
......
...@@ -64,7 +64,7 @@ assert_entry_array_valid(const entry_array a_entries, true_type) const ...@@ -64,7 +64,7 @@ assert_entry_array_valid(const entry_array a_entries, true_type) const
case valid_entry_status: case valid_entry_status:
{ {
const_key_reference r_key = PB_DS_V2F(p_e->m_value); const_key_reference r_key = PB_DS_V2F(p_e->m_value);
map_debug_base::check_key_exists(r_key); debug_base::check_key_exists(r_key);
const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key); const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
......
...@@ -50,7 +50,7 @@ PB_DS_CLASS_C_DEC:: ...@@ -50,7 +50,7 @@ PB_DS_CLASS_C_DEC::
erase_entry(entry_pointer p_e) erase_entry(entry_pointer p_e)
{ {
_GLIBCXX_DEBUG_ASSERT(p_e->m_stat = valid_entry_status); _GLIBCXX_DEBUG_ASSERT(p_e->m_stat = valid_entry_status);
_GLIBCXX_DEBUG_ONLY(map_debug_base::erase_existing(PB_DS_V2F(p_e->m_value));) _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_e->m_value));)
p_e->m_value.~value_type(); p_e->m_value.~value_type();
p_e->m_stat = erased_entry_status; p_e->m_stat = erased_entry_status;
_GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0); _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);
......
...@@ -64,7 +64,7 @@ erase_imp(const_key_reference r_key, false_type) ...@@ -64,7 +64,7 @@ erase_imp(const_key_reference r_key, false_type)
case empty_entry_status: case empty_entry_status:
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist( _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(
r_key)); r_key));
return false; return false;
} }
......
...@@ -63,7 +63,7 @@ erase_imp(const_key_reference r_key, true_type) ...@@ -63,7 +63,7 @@ erase_imp(const_key_reference r_key, true_type)
case empty_entry_status: case empty_entry_status:
{ {
resize_base::notify_erase_search_end(); resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist( _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(
r_key)); r_key));
return false; return false;
} }
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#include <iostream> #include <iostream>
#endif #endif
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/map_debug_base.hpp> #include <ext/pb_ds/detail/debug_map_base.hpp>
#endif #endif
#include <debug/debug.h> #include <debug/debug.h>
...@@ -89,8 +89,8 @@ namespace pb_ds ...@@ -89,8 +89,8 @@ namespace pb_ds
types_traits<Key, Mapped, Allocator, Store_Hash> types_traits<Key, Mapped, Allocator, Store_Hash>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#define PB_DS_MAP_DEBUG_BASE_C_DEC \ #define PB_DS_DEBUG_MAP_BASE_C_DEC \
map_debug_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference> debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
#endif #endif
#ifdef PB_DS_DATA_TRUE_INDICATOR #ifdef PB_DS_DATA_TRUE_INDICATOR
...@@ -114,7 +114,7 @@ namespace pb_ds ...@@ -114,7 +114,7 @@ namespace pb_ds
typename Resize_Policy> typename Resize_Policy>
class PB_DS_CLASS_NAME : class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
protected PB_DS_MAP_DEBUG_BASE_C_DEC, protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif #endif
public PB_DS_HASH_EQ_FN_C_DEC, public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy, public Resize_Policy,
...@@ -152,7 +152,7 @@ namespace pb_ds ...@@ -152,7 +152,7 @@ namespace pb_ds
typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base; typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base; typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif #endif
typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base; typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
...@@ -410,7 +410,7 @@ namespace pb_ds ...@@ -410,7 +410,7 @@ namespace pb_ds
p_e->m_stat = valid_entry_status; p_e->m_stat = valid_entry_status;
resize_base::notify_inserted(++m_num_used_e); resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(p_e->m_value));) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return &p_e->m_value; return &p_e->m_value;
...@@ -436,7 +436,7 @@ namespace pb_ds ...@@ -436,7 +436,7 @@ namespace pb_ds
resize_base::notify_inserted(++m_num_used_e); resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(p_e->m_value));) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return &p_e->m_value; return &p_e->m_value;
...@@ -455,7 +455,7 @@ namespace pb_ds ...@@ -455,7 +455,7 @@ namespace pb_ds
if (p_e->m_stat != valid_entry_status) if (p_e->m_stat != valid_entry_status)
return insert_new_imp(value_type(key, mapped_type()), pos)->second; return insert_new_imp(value_type(key, mapped_type()), pos)->second;
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
return p_e->m_value.second; return p_e->m_value.second;
} }
...@@ -471,7 +471,7 @@ namespace pb_ds ...@@ -471,7 +471,7 @@ namespace pb_ds
return insert_new_imp(value_type(key, mapped_type()), return insert_new_imp(value_type(key, mapped_type()),
pos_hash_pair)->second; pos_hash_pair)->second;
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key));
return (m_entries + pos_hash_pair.first)->m_value.second; return (m_entries + pos_hash_pair.first)->m_value.second;
} }
#endif #endif
...@@ -494,7 +494,7 @@ namespace pb_ds ...@@ -494,7 +494,7 @@ namespace pb_ds
case empty_entry_status: case empty_entry_status:
{ {
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
return NULL; return NULL;
} }
...@@ -503,7 +503,7 @@ namespace pb_ds ...@@ -503,7 +503,7 @@ namespace pb_ds
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key)) if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key))
{ {
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
return pointer(&p_e->m_value); return pointer(&p_e->m_value);
} }
...@@ -517,7 +517,7 @@ namespace pb_ds ...@@ -517,7 +517,7 @@ namespace pb_ds
resize_base::notify_find_search_collision(); resize_base::notify_find_search_collision();
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
return NULL; return NULL;
} }
...@@ -542,7 +542,7 @@ namespace pb_ds ...@@ -542,7 +542,7 @@ namespace pb_ds
case empty_entry_status: case empty_entry_status:
{ {
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
return NULL; return NULL;
} }
...@@ -553,7 +553,7 @@ namespace pb_ds ...@@ -553,7 +553,7 @@ namespace pb_ds
key, pos_hash_pair.second)) key, pos_hash_pair.second))
{ {
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
return pointer(&p_e->m_value); return pointer(&p_e->m_value);
} }
break; break;
...@@ -566,7 +566,7 @@ namespace pb_ds ...@@ -566,7 +566,7 @@ namespace pb_ds
resize_base::notify_find_search_collision(); resize_base::notify_find_search_collision();
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
return NULL; return NULL;
} }
...@@ -673,7 +673,7 @@ namespace pb_ds ...@@ -673,7 +673,7 @@ namespace pb_ds
#undef PB_DS_HASH_EQ_FN_C_DEC #undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_PROBE_FN_C_DEC #undef PB_DS_RANGED_PROBE_FN_C_DEC
#undef PB_DS_TYPES_TRAITS_C_DEC #undef PB_DS_TYPES_TRAITS_C_DEC
#undef PB_DS_MAP_DEBUG_BASE_C_DEC #undef PB_DS_DEBUG_MAP_BASE_C_DEC
#undef PB_DS_CLASS_NAME #undef PB_DS_CLASS_NAME
#undef PB_DS_V2F #undef PB_DS_V2F
#undef PB_DS_V2S #undef PB_DS_V2S
......
...@@ -68,7 +68,7 @@ find_ins_pos(const_key_reference r_key, false_type) ...@@ -68,7 +68,7 @@ find_ins_pos(const_key_reference r_key, false_type)
case empty_entry_status: case empty_entry_status:
{ {
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return (ins_pos == m_num_e) ? pos : ins_pos; return (ins_pos == m_num_e) ? pos : ins_pos;
} }
break; break;
...@@ -80,7 +80,7 @@ find_ins_pos(const_key_reference r_key, false_type) ...@@ -80,7 +80,7 @@ find_ins_pos(const_key_reference r_key, false_type)
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{ {
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return pos; return pos;
} }
break; break;
...@@ -107,11 +107,11 @@ insert_imp(const_reference r_val, false_type) ...@@ -107,11 +107,11 @@ insert_imp(const_reference r_val, false_type)
if (m_entries[pos].m_stat == valid_entry_status) if (m_entries[pos].m_stat == valid_entry_status)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return std::make_pair(&(m_entries + pos)->m_value, false); return std::make_pair(&(m_entries + pos)->m_value, false);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
return std::make_pair(insert_new_imp(r_val, pos), true); return std::make_pair(insert_new_imp(r_val, pos), true);
} }
...@@ -70,7 +70,7 @@ find_ins_pos(const_key_reference r_key, true_type) ...@@ -70,7 +70,7 @@ find_ins_pos(const_key_reference r_key, true_type)
case empty_entry_status: case empty_entry_status:
{ {
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return ((ins_pos == m_num_e) ? return ((ins_pos == m_num_e) ?
std::make_pair(pos, pos_hash_pair.second) : std::make_pair(pos, pos_hash_pair.second) :
...@@ -86,7 +86,7 @@ find_ins_pos(const_key_reference r_key, true_type) ...@@ -86,7 +86,7 @@ find_ins_pos(const_key_reference r_key, true_type)
r_key, pos_hash_pair.second)) r_key, pos_hash_pair.second))
{ {
resize_base::notify_insert_search_end(); resize_base::notify_insert_search_end();
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return std::make_pair(pos, pos_hash_pair.second); return std::make_pair(pos, pos_hash_pair.second);
} }
break; break;
...@@ -114,11 +114,11 @@ insert_imp(const_reference r_val, true_type) ...@@ -114,11 +114,11 @@ insert_imp(const_reference r_val, true_type)
entry_pointer p_e =& m_entries[pos_hash_pair.first]; entry_pointer p_e =& m_entries[pos_hash_pair.first];
if (p_e->m_stat == valid_entry_status) if (p_e->m_stat == valid_entry_status)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
return std::make_pair(&p_e->m_value, false); return std::make_pair(&p_e->m_value, false);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true); return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
} }
...@@ -89,7 +89,7 @@ PB_DS_CLASS_T_DEC ...@@ -89,7 +89,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
map_debug_base(), debug_base(),
#endif #endif
m_p_l(NULL) m_p_l(NULL)
{ {
...@@ -119,7 +119,7 @@ swap(PB_DS_CLASS_C_DEC& other) ...@@ -119,7 +119,7 @@ swap(PB_DS_CLASS_C_DEC& other)
{ {
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
_GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);) _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_p_l, other.m_p_l); std::swap(m_p_l, other.m_p_l);
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
......
...@@ -54,10 +54,10 @@ assert_valid() const ...@@ -54,10 +54,10 @@ assert_valid() const
size_type calc_size = 0; size_type calc_size = 0;
for (const_iterator it = begin(); it != end(); ++it) for (const_iterator it = begin(); it != end(); ++it)
{ {
map_debug_base::check_key_exists(PB_DS_V2F(*it)); debug_base::check_key_exists(PB_DS_V2F(*it));
++calc_size; ++calc_size;
} }
map_debug_base::check_size(calc_size); debug_base::check_size(calc_size);
} }
#endif #endif
...@@ -134,7 +134,7 @@ void ...@@ -134,7 +134,7 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
actual_erase_entry(entry_pointer p_l) actual_erase_entry(entry_pointer p_l)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::erase_existing(PB_DS_V2F(p_l->m_value));) _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->m_value));)
p_l->~entry(); p_l->~entry();
s_entry_allocator.deallocate(p_l, 1); s_entry_allocator.deallocate(p_l, 1);
} }
......
...@@ -54,7 +54,7 @@ find_imp(const_key_reference r_key) const ...@@ -54,7 +54,7 @@ find_imp(const_key_reference r_key) const
if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value))) if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
{ {
apply_update(m_p_l, s_metadata_type_indicator); apply_update(m_p_l, s_metadata_type_indicator);
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return m_p_l; return m_p_l;
} }
...@@ -77,7 +77,7 @@ find_imp(const_key_reference r_key) const ...@@ -77,7 +77,7 @@ find_imp(const_key_reference r_key) const
p_l = p_next; p_l = p_next;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return NULL; return NULL;
} }
......
...@@ -56,11 +56,11 @@ insert(const_reference r_val) ...@@ -56,11 +56,11 @@ insert(const_reference r_val)
if (p_l != NULL) if (p_l != NULL)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(r_val));)
return std::make_pair(point_iterator(&p_l->m_value), false); return std::make_pair(point_iterator(&p_l->m_value), false);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(PB_DS_V2F(r_val));)
p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator); p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator);
p_l->m_p_next = m_p_l; p_l->m_p_next = m_p_l;
...@@ -80,7 +80,7 @@ allocate_new_entry(const_reference r_val, false_type) ...@@ -80,7 +80,7 @@ allocate_new_entry(const_reference r_val, false_type)
value_type(r_val); value_type(r_val);
cond.set_no_action(); cond.set_no_action();
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
init_entry_metadata(p_l, s_metadata_type_indicator); init_entry_metadata(p_l, s_metadata_type_indicator);
return p_l; return p_l;
} }
...@@ -92,7 +92,7 @@ allocate_new_entry(const_reference r_val, true_type) ...@@ -92,7 +92,7 @@ allocate_new_entry(const_reference r_val, true_type)
{ {
entry_pointer p_l = s_entry_allocator.allocate(1); entry_pointer p_l = s_entry_allocator.allocate(1);
new (&p_l->m_value) value_type(r_val); new (&p_l->m_value) value_type(r_val);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
init_entry_metadata(p_l, s_metadata_type_indicator); init_entry_metadata(p_l, s_metadata_type_indicator);
return p_l; return p_l;
} }
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp> #include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp>
#include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/exception.hpp>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/map_debug_base.hpp> #include <ext/pb_ds/detail/debug_map_base.hpp>
#endif #endif
#ifdef PB_DS_LU_MAP_TRACE_ #ifdef PB_DS_LU_MAP_TRACE_
#include <iostream> #include <iostream>
...@@ -82,8 +82,8 @@ namespace pb_ds ...@@ -82,8 +82,8 @@ namespace pb_ds
types_traits<Key, Mapped, Allocator, false> types_traits<Key, Mapped, Allocator, false>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#define PB_DS_MAP_DEBUG_BASE_C_DEC \ #define PB_DS_DEBUG_MAP_BASE_C_DEC \
map_debug_base<Key, Eq_Fn, \ debug_map_base<Key, Eq_Fn, \
typename Allocator::template rebind<Key>::other::const_reference> typename Allocator::template rebind<Key>::other::const_reference>
#endif #endif
...@@ -108,7 +108,7 @@ namespace pb_ds ...@@ -108,7 +108,7 @@ namespace pb_ds
class Update_Policy> class Update_Policy>
class PB_DS_CLASS_NAME : class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
protected PB_DS_MAP_DEBUG_BASE_C_DEC, protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif #endif
public PB_DS_TYPES_TRAITS_C_DEC public PB_DS_TYPES_TRAITS_C_DEC
{ {
...@@ -148,7 +148,7 @@ namespace pb_ds ...@@ -148,7 +148,7 @@ namespace pb_ds
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base; typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif #endif
typedef cond_dealtor<entry, Allocator> cond_dealtor_t; typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
...@@ -355,7 +355,7 @@ namespace pb_ds ...@@ -355,7 +355,7 @@ namespace pb_ds
#undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_C_DEC
#undef PB_DS_TYPES_TRAITS_C_DEC #undef PB_DS_TYPES_TRAITS_C_DEC
#undef PB_DS_MAP_DEBUG_BASE_C_DEC #undef PB_DS_DEBUG_MAP_BASE_C_DEC
#undef PB_DS_CLASS_NAME #undef PB_DS_CLASS_NAME
#undef PB_DS_V2F #undef PB_DS_V2F
#undef PB_DS_EP2VP #undef PB_DS_EP2VP
......
...@@ -86,7 +86,7 @@ PB_DS_CLASS_T_DEC ...@@ -86,7 +86,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
map_debug_base(other), debug_base(other),
#endif #endif
#ifdef PB_DS_TREE_TRACE #ifdef PB_DS_TREE_TRACE
PB_DS_TREE_TRACE_BASE_C_DEC(other), PB_DS_TREE_TRACE_BASE_C_DEC(other),
...@@ -166,7 +166,7 @@ copy_from_ordered_range(It first_it, It last_it) ...@@ -166,7 +166,7 @@ copy_from_ordered_range(It first_it, It last_it)
const_iterator dbg_it = m_a_values; const_iterator dbg_it = m_a_values;
while (dbg_it != m_end_it) while (dbg_it != m_end_it)
{ {
map_debug_base::insert_new(PB_DS_V2F(*dbg_it)); debug_base::insert_new(PB_DS_V2F(*dbg_it));
dbg_it++; dbg_it++;
} }
PB_DS_CLASS_C_DEC::assert_valid(); PB_DS_CLASS_C_DEC::assert_valid();
...@@ -219,7 +219,7 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it, ...@@ -219,7 +219,7 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it,
const_iterator dbg_it = m_a_values; const_iterator dbg_it = m_a_values;
while (dbg_it != m_end_it) while (dbg_it != m_end_it)
{ {
map_debug_base::insert_new(PB_DS_V2F(*dbg_it)); debug_base::insert_new(PB_DS_V2F(*dbg_it));
dbg_it++; dbg_it++;
} }
PB_DS_CLASS_C_DEC::assert_valid(); PB_DS_CLASS_C_DEC::assert_valid();
...@@ -246,7 +246,7 @@ value_swap(PB_DS_CLASS_C_DEC& other) ...@@ -246,7 +246,7 @@ value_swap(PB_DS_CLASS_C_DEC& other)
std::swap(m_a_metadata, other.m_a_metadata); std::swap(m_a_metadata, other.m_a_metadata);
std::swap(m_size, other.m_size); std::swap(m_size, other.m_size);
std::swap(m_end_it, other.m_end_it); std::swap(m_end_it, other.m_end_it);
_GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);) _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
} }
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
......
...@@ -66,14 +66,14 @@ void ...@@ -66,14 +66,14 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
assert_iterators() const assert_iterators() const
{ {
map_debug_base::check_size(m_size); debug_base::check_size(m_size);
size_type iterated_num = 0; size_type iterated_num = 0;
const_iterator prev_it = end(); const_iterator prev_it = end();
_GLIBCXX_DEBUG_ASSERT( m_end_it == m_a_values + m_size); _GLIBCXX_DEBUG_ASSERT( m_end_it == m_a_values + m_size);
for (const_iterator it = begin(); it != end(); ++it) for (const_iterator it = begin(); it != end(); ++it)
{ {
++iterated_num; ++iterated_num;
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(PB_DS_V2F(*it));) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(*it));)
_GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it); _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it);
const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it)); const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
--upper_bound_it; --upper_bound_it;
......
...@@ -61,7 +61,7 @@ clear() ...@@ -61,7 +61,7 @@ clear()
cond_dtor<size_type> cd(m_a_values, m_end_it, m_size); cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear();) _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
m_a_values = NULL; m_a_values = NULL;
m_size = 0; m_size = 0;
m_end_it = m_a_values; m_end_it = m_a_values;
...@@ -98,7 +98,7 @@ erase_if(Pred pred) ...@@ -98,7 +98,7 @@ erase_if(Pred pred)
value_vector a_new_values = s_value_alloc.allocate(new_size); value_vector a_new_values = s_value_alloc.allocate(new_size);
iterator target_it = a_new_values; iterator target_it = a_new_values;
cond_dtor<size_type> cd(a_new_values, target_it, new_size); cond_dtor<size_type> cd(a_new_values, target_it, new_size);
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear()); _GLIBCXX_DEBUG_ONLY(debug_base::clear());
for (source_it = begin(); source_it != m_end_it; ++source_it) for (source_it = begin(); source_it != m_end_it; ++source_it)
{ {
if (!pred(*source_it)) if (!pred(*source_it))
...@@ -106,7 +106,7 @@ erase_if(Pred pred) ...@@ -106,7 +106,7 @@ erase_if(Pred pred)
new (const_cast<void*>(static_cast<const void* >(target_it))) new (const_cast<void*>(static_cast<const void* >(target_it)))
value_type(*source_it); value_type(*source_it);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(*source_it))); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it)));
++target_it; ++target_it;
} }
} }
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp> #include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
#include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/detail/map_debug_base.hpp> #include <ext/pb_ds/detail/debug_map_base.hpp>
#include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/detail/tree_trace_base.hpp> #include <ext/pb_ds/detail/tree_trace_base.hpp>
...@@ -89,8 +89,8 @@ namespace pb_ds ...@@ -89,8 +89,8 @@ namespace pb_ds
types_traits<Key, Mapped, Allocator, false> types_traits<Key, Mapped, Allocator, false>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#define PB_DS_MAP_DEBUG_BASE_C_DEC \ #define PB_DS_DEBUG_MAP_BASE_C_DEC \
map_debug_base<Key, eq_by_less<Key, Cmp_Fn>, \ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
typename Allocator::template rebind<Key>::other::const_reference> typename Allocator::template rebind<Key>::other::const_reference>
#endif #endif
...@@ -118,7 +118,7 @@ namespace pb_ds ...@@ -118,7 +118,7 @@ namespace pb_ds
class Node_And_It_Traits, class Allocator> class Node_And_It_Traits, class Allocator>
class PB_DS_OV_TREE_CLASS_NAME : class PB_DS_OV_TREE_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
protected PB_DS_MAP_DEBUG_BASE_C_DEC, protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif #endif
#ifdef PB_DS_TREE_TRACE #ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC, public PB_DS_TREE_TRACE_BASE_C_DEC,
...@@ -139,7 +139,7 @@ namespace pb_ds ...@@ -139,7 +139,7 @@ namespace pb_ds
typedef Cmp_Fn cmp_fn_base; typedef Cmp_Fn cmp_fn_base;
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base; typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif #endif
typedef typename traits_base::pointer mapped_pointer_; typedef typename traits_base::pointer mapped_pointer_;
...@@ -244,7 +244,7 @@ namespace pb_ds ...@@ -244,7 +244,7 @@ namespace pb_ds
point_iterator it = lower_bound(r_key); point_iterator it = lower_bound(r_key);
if (it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it))) if (it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return it->second; return it->second;
} }
...@@ -267,7 +267,7 @@ namespace pb_ds ...@@ -267,7 +267,7 @@ namespace pb_ds
if (it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it))) if (it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))
{ {
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
return std::make_pair(it, false); return std::make_pair(it, false);
} }
...@@ -301,11 +301,11 @@ namespace pb_ds ...@@ -301,11 +301,11 @@ namespace pb_ds
iterator pot_it = lower_bound(r_key); iterator pot_it = lower_bound(r_key);
if (pot_it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it))) if (pot_it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
return ++pot_it; return ++pot_it;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
return pot_it; return pot_it;
} }
...@@ -320,11 +320,11 @@ namespace pb_ds ...@@ -320,11 +320,11 @@ namespace pb_ds
iterator pot_it = lower_bound(r_key); iterator pot_it = lower_bound(r_key);
if (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it))) if (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
return pot_it; return pot_it;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
return end(); return end();
} }
...@@ -423,7 +423,7 @@ namespace pb_ds ...@@ -423,7 +423,7 @@ namespace pb_ds
typename Allocator::group_throw_prob_adjustor adjust(m_size); typename Allocator::group_throw_prob_adjustor adjust(m_size);
#endif #endif
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(PB_DS_V2F(r_value))); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(PB_DS_V2F(r_value)));
value_vector a_values = s_value_alloc.allocate(m_size + 1); value_vector a_values = s_value_alloc.allocate(m_size + 1);
...@@ -461,7 +461,7 @@ namespace pb_ds ...@@ -461,7 +461,7 @@ namespace pb_ds
++m_size; ++m_size;
m_a_values = a_values; m_a_values = a_values;
m_end_it = m_a_values + m_size; m_end_it = m_a_values + m_size;
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_value))); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value)));
update(node_begin(), (node_update* )this); update(node_begin(), (node_update* )this);
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
return ret_it; return ret_it;
...@@ -514,7 +514,7 @@ namespace pb_ds ...@@ -514,7 +514,7 @@ namespace pb_ds
#undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_T_DEC
#undef PB_DS_OV_TREE_CLASS_NAME #undef PB_DS_OV_TREE_CLASS_NAME
#undef PB_DS_TYPES_TRAITS_C_DEC #undef PB_DS_TYPES_TRAITS_C_DEC
#undef PB_DS_MAP_DEBUG_BASE_C_DEC #undef PB_DS_DEBUG_MAP_BASE_C_DEC
#ifdef PB_DS_TREE_TRACE #ifdef PB_DS_TREE_TRACE
#undef PB_DS_TREE_TRACE_BASE_C_DEC #undef PB_DS_TREE_TRACE_BASE_C_DEC
#endif #endif
......
...@@ -83,7 +83,7 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other) ...@@ -83,7 +83,7 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
return; return;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);) _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
iterator it = upper_bound(r_key); iterator it = upper_bound(r_key);
PB_DS_CLASS_C_DEC new_other(other, other); PB_DS_CLASS_C_DEC new_other(other, other);
new_other.copy_from_ordered_range(it, end()); new_other.copy_from_ordered_range(it, end());
...@@ -91,7 +91,7 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other) ...@@ -91,7 +91,7 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
new_this.copy_from_ordered_range(begin(), it); new_this.copy_from_ordered_range(begin(), it);
// No exceptions from this point. // No exceptions from this point.
_GLIBCXX_DEBUG_ONLY(map_debug_base::split(r_key,(Cmp_Fn& )(*this), other);) _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);)
other.update(other.node_begin(), (node_update* )(&other)); other.update(other.node_begin(), (node_update* )(&other));
update(node_begin(), (node_update* )this); update(node_begin(), (node_update* )this);
other.value_swap(new_other); other.value_swap(new_other);
...@@ -135,7 +135,7 @@ join(PB_DS_CLASS_C_DEC& other) ...@@ -135,7 +135,7 @@ join(PB_DS_CLASS_C_DEC& other)
begin(), end()); begin(), end());
// No exceptions from this point. // No exceptions from this point.
_GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);) _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
value_swap(new_this); value_swap(new_this);
other.clear(); other.clear();
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
......
...@@ -81,7 +81,7 @@ PB_DS_CLASS_T_DEC ...@@ -81,7 +81,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
map_debug_base(other), debug_base(other),
#endif #endif
synth_e_access_traits(other), synth_e_access_traits(other),
node_update(other), node_update(other),
...@@ -130,7 +130,7 @@ void ...@@ -130,7 +130,7 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other) value_swap(PB_DS_CLASS_C_DEC& other)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);) _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_p_head, other.m_p_head); std::swap(m_p_head, other.m_p_head);
std::swap(m_size, other.m_size); std::swap(m_size, other.m_size);
} }
......
...@@ -77,7 +77,7 @@ assert_iterators() const ...@@ -77,7 +77,7 @@ assert_iterators() const
for (const_iterator it = begin(); it != end(); ++it) for (const_iterator it = begin(); it != end(); ++it)
{ {
++calc_size; ++calc_size;
map_debug_base::check_key_exists(PB_DS_V2F(*it)); debug_base::check_key_exists(PB_DS_V2F(*it));
_GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it); _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it);
_GLIBCXX_DEBUG_ASSERT(--upper_bound(PB_DS_V2F(*it)) == it); _GLIBCXX_DEBUG_ASSERT(--upper_bound(PB_DS_V2F(*it)) == it);
} }
......
...@@ -52,18 +52,18 @@ erase(const_key_reference r_key) ...@@ -52,18 +52,18 @@ erase(const_key_reference r_key)
node_pointer p_nd = find_imp(r_key); node_pointer p_nd = find_imp(r_key);
if (p_nd == NULL || p_nd->m_type == pat_trie_internal_node_type) if (p_nd == NULL || p_nd->m_type == pat_trie_internal_node_type)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
return false; return false;
} }
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type); _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
if (!synth_e_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key)) if (!synth_e_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
return false; return false;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
erase_leaf(static_cast<leaf_pointer>(p_nd)); erase_leaf(static_cast<leaf_pointer>(p_nd));
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return true; return true;
...@@ -141,7 +141,7 @@ clear() ...@@ -141,7 +141,7 @@ clear()
clear_imp(m_p_head->m_p_parent); clear_imp(m_p_head->m_p_parent);
m_size = 0; m_size = 0;
initialize(); initialize();
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear();) _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
} }
......
...@@ -54,17 +54,17 @@ find(const_key_reference r_key) ...@@ -54,17 +54,17 @@ find(const_key_reference r_key)
if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type) if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return end(); return end();
} }
if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key)) if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
return iterator(p_nd); return iterator(p_nd);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return end(); return end();
} }
...@@ -79,17 +79,17 @@ find(const_key_reference r_key) const ...@@ -79,17 +79,17 @@ find(const_key_reference r_key) const
if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type) if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return end(); return end();
} }
if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key)) if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key)); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
return const_iterator(const_cast<node_pointer>(p_nd)); return const_iterator(const_cast<node_pointer>(p_nd));
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);) _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return end(); return end();
} }
......
...@@ -98,7 +98,7 @@ join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag) ...@@ -98,7 +98,7 @@ join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
__throw_join_error(); __throw_join_error();
rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag); rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag);
_GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);) _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
return true; return true;
} }
...@@ -387,12 +387,12 @@ insert(const_reference r_val) ...@@ -387,12 +387,12 @@ insert(const_reference r_val)
if (p_lf != NULL && p_lf->m_type == pat_trie_leaf_node_type && if (p_lf != NULL && p_lf->m_type == pat_trie_leaf_node_type &&
synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val))) synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
{ {
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(PB_DS_V2F(r_val))); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(r_val)));
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return std::make_pair(iterator(p_lf), false); return std::make_pair(iterator(p_lf), false);
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(PB_DS_V2F(r_val))); _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(PB_DS_V2F(r_val)));
leaf_pointer p_new_lf = s_leaf_allocator.allocate(1); leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
cond_dealtor cond(p_new_lf); cond_dealtor cond(p_new_lf);
...@@ -407,7 +407,7 @@ insert(const_reference r_val) ...@@ -407,7 +407,7 @@ insert(const_reference r_val)
cond.set_no_action_dtor(); cond.set_no_action_dtor();
++m_size; ++m_size;
update_min_max_for_inserted_leaf(p_new_lf); update_min_max_for_inserted_leaf(p_new_lf);
_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
return std::make_pair(point_iterator(p_new_lf), true); return std::make_pair(point_iterator(p_new_lf), true);
} }
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#include <assert.h> #include <assert.h>
#include <list> #include <list>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/map_debug_base.hpp> #include <ext/pb_ds/detail/debug_map_base.hpp>
#endif #endif
#include <debug/debug.h> #include <debug/debug.h>
...@@ -94,8 +94,8 @@ namespace pb_ds ...@@ -94,8 +94,8 @@ namespace pb_ds
types_traits<Key, Mapped, Allocator, false> types_traits<Key, Mapped, Allocator, false>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
#define PB_DS_MAP_DEBUG_BASE_C_DEC \ #define PB_DS_DEBUG_MAP_BASE_C_DEC \
map_debug_base<Key, eq_by_less<Key, \ debug_map_base<Key, eq_by_less<Key, \
std::less<Key> >, typename Allocator::template rebind<Key>::other::const_reference> std::less<Key> >, typename Allocator::template rebind<Key>::other::const_reference>
#endif #endif
...@@ -120,7 +120,7 @@ namespace pb_ds ...@@ -120,7 +120,7 @@ namespace pb_ds
typename Allocator> typename Allocator>
class PB_DS_CLASS_NAME : class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
public PB_DS_MAP_DEBUG_BASE_C_DEC, public PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif #endif
public Node_And_It_Traits::synth_e_access_traits, public Node_And_It_Traits::synth_e_access_traits,
public Node_And_It_Traits::node_update, public Node_And_It_Traits::node_update,
...@@ -155,7 +155,7 @@ namespace pb_ds ...@@ -155,7 +155,7 @@ namespace pb_ds
#include <ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp> #include <ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp>
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base; typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif #endif
#include <ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp> #include <ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp>
...@@ -512,7 +512,7 @@ namespace pb_ds ...@@ -512,7 +512,7 @@ namespace pb_ds
#undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_NAME #undef PB_DS_CLASS_NAME
#undef PB_DS_TYPES_TRAITS_C_DEC #undef PB_DS_TYPES_TRAITS_C_DEC
#undef PB_DS_MAP_DEBUG_BASE_C_DEC #undef PB_DS_DEBUG_MAP_BASE_C_DEC
#undef PB_DS_V2F #undef PB_DS_V2F
#undef PB_DS_EP2VP #undef PB_DS_EP2VP
#undef PB_DS_V2S #undef PB_DS_V2S
......
...@@ -90,7 +90,7 @@ clear() ...@@ -90,7 +90,7 @@ clear()
clear_imp(m_p_head->m_p_parent); clear_imp(m_p_head->m_p_parent);
m_size = 0; m_size = 0;
initialize(); initialize();
_GLIBCXX_DEBUG_ONLY(map_debug_base::clear();) _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(assert_valid(true, true);) _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)
} }
......
...@@ -128,7 +128,7 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branc ...@@ -128,7 +128,7 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branc
r_bag.add_branch(); r_bag.add_branch();
p_nd = p_nd->m_p_parent; p_nd = p_nd->m_p_parent;
} }
_GLIBCXX_DEBUG_ONLY(map_debug_base::split(r_key,(synth_e_access_traits& )(*this), other);) _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_e_access_traits& )(*this), other);)
return (p_ret_l); return (p_ret_l);
} }
......
...@@ -175,7 +175,7 @@ notify_externally_resized(size_type new_size) ...@@ -175,7 +175,7 @@ notify_externally_resized(size_type new_size)
{ {
m_resize_needed = false; m_resize_needed = false;
size_type new_grow_size = size_type(m_load_max * new_size - 1); size_type new_grow_size = size_type(m_load_max * new_size - 1);
size_type new_shrink_size = size_type(m_load_min * new_size ); size_type new_shrink_size = size_type(m_load_min * new_size);
if (new_grow_size >= m_next_grow_size) if (new_grow_size >= m_next_grow_size)
{ {
_GLIBCXX_DEBUG_ASSERT(new_shrink_size > m_next_shrink_size); _GLIBCXX_DEBUG_ASSERT(new_shrink_size > m_next_shrink_size);
......
...@@ -74,10 +74,13 @@ namespace pb_ds ...@@ -74,10 +74,13 @@ namespace pb_ds
typedef typename Alloc::size_type size_type; typedef typename Alloc::size_type size_type;
// Extra value (used when the extra value is stored with each value). // Extra value (used when the extra value is stored with each value).
typedef std::pair<size_type, size_type> comp_hash; typedef std::pair<size_type, size_type> comp_hash;
integral_constant<int, Store_Extra> m_store_extra_indicator; typedef integral_constant<int, Store_Extra> store_extra;
typename no_throw_copies<Key, Mapped>::indicator m_no_throw_copies_indicator; store_extra m_store_extra_indicator;
typedef typename no_throw_copies<Key, Mapped>::indicator no_throw_copies;
no_throw_copies m_no_throw_copies_indicator;
}; };
} // namespace detail } // namespace detail
} // namespace pb_ds } // namespace pb_ds
......
...@@ -50,6 +50,11 @@ ...@@ -50,6 +50,11 @@
#include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/type_utils.hpp>
/**
* @namespace pb_ds
* @brief GNU extension policy-based data structures for public use.
*/
namespace pb_ds namespace pb_ds
{ {
// A trivial iterator tag. Signifies that the iterators has none of // A trivial iterator tag. Signifies that the iterators has none of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment