${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/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_/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.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/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_/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \
#include <ext/pb_ds/exception.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/map_debug_base.hpp>
+#include <ext/pb_ds/detail/debug_map_base.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
false>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_MAP_DEBUG_BASE_C_DEC \
- map_debug_base<Key, eq_by_less<Key, Cmp_Fn>, \
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
typename Allocator::template rebind<Key>::other::const_reference>
#endif
class Allocator>
class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG
- public PB_DS_MAP_DEBUG_BASE_C_DEC,
+ public PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
#ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC,
typedef cond_dealtor< node, Allocator> cond_dealtor_t;
#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
public:
#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
#undef PB_DS_TREE_TRACE_BASE_C_DEC
PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
- map_debug_base(other),
+ debug_base(other),
#endif
#ifdef PB_DS_TREE_TRACE
PB_DS_TREE_TRACE_BASE_C_DEC(other),
}
catch(...)
{
- _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
s_node_allocator.deallocate(m_p_head, 1);
__throw_exception_again;
}
PB_DS_CLASS_C_DEC::
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_size, other.m_size);
}
PB_DS_CLASS_C_DEC::
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);
}
{
if (p_nd == NULL)
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_right);
}
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();)
- _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(
PB_DS_V2F(r_value)));
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)));
p_nd = p_pot->m_p_left;
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)));
return (iterator(p_new_nd));
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)));
update_to_top(m_p_head->m_p_parent, (node_update* )this);
initialize();
- _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
}
value_swap(other);
m_size += other.m_size;
- _GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)
+ _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
return true;
}
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;
}
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
#ifdef _GLIBCXX_DEBUG
-#include <ext/pb_ds/detail/map_debug_base.hpp>
+#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#ifdef PB_DS_HT_MAP_TRACE_
#include <iostream>
types_traits<Key, Mapped, Allocator, Store_Hash>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_MAP_DEBUG_BASE_C_DEC \
- map_debug_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
#endif
#ifdef PB_DS_DATA_TRUE_INDICATOR
typename Resize_Policy >
class PB_DS_CLASS_NAME:
#ifdef _GLIBCXX_DEBUG
- protected PB_DS_MAP_DEBUG_BASE_C_DEC,
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy,
typedef Resize_Policy resize_base;
#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
#define PB_DS_GEN_POS std::pair<entry_pointer, typename Allocator::size_type>
resize_base::notify_insert_search_end();
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);
}
- _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;
}
resize_base::notify_insert_search_end();
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;
}
- _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_hash_pair)->second;
}
m_entries[pos] = p_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();)
return &p_e->m_value;
}
p_e->m_p_next = m_entries[r_pos_hash_pair.first];
m_entries[r_pos_hash_pair.first] = p_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();)
return &p_e->m_value;
}
#ifdef _GLIBCXX_DEBUG
if (p_e == NULL)
- map_debug_base::check_key_does_not_exist(r_key);
+ debug_base::check_key_does_not_exist(r_key);
else
- map_debug_base::check_key_exists(r_key);
+ debug_base::check_key_exists(r_key);
#endif
return &p_e->m_value;
}
#ifdef _GLIBCXX_DEBUG
if (p_e == NULL)
- map_debug_base::check_key_does_not_exist(r_key);
+ debug_base::check_key_does_not_exist(r_key);
else
- map_debug_base::check_key_exists(r_key);
+ debug_base::check_key_exists(r_key);
#endif
return &p_e->m_value;
}
#undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_HASH_FN_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_V2F
#undef PB_DS_V2S
const_mapped_pointer p_mapped_value =
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)
return false;
PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
- map_debug_base(other),
+ debug_base(other),
#endif
PB_DS_HASH_EQ_FN_C_DEC(other),
resize_base(other), ranged_hash_fn_base(other),
hash_eq_fn_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(other.assert_valid());
}
// At this point no exceptions can be thrown.
p->m_p_next = m_entries[pos];
m_entries[pos] = p;
- _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(r_key);)
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
}
p->m_hash = ranged_hash_fn_base::operator()((const_key_reference)(PB_DS_V2F(p->m_value))).second;
m_entries[pos] = p;
- _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(r_key);)
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
}
PB_DS_CLASS_C_DEC::
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);
}
while (p_e != NULL)
{
++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;
}
}
void
PB_DS_CLASS_C_DEC::
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
PB_DS_CLASS_C_DEC::
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));
_GLIBCXX_DEBUG_ASSERT(p_e->m_hash == pos_hash_pair.second);
}
PB_DS_CLASS_C_DEC::
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;
r_p_e = r_p_e->m_p_next;
if (p_e == NULL)
{
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();)
return false;
}
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
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]);
do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
if (p_next_e == NULL)
{
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();)
return false;
}
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key))
{
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);
do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
if (p_e == NULL)
{
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();)
return false;
}
r_key, r_pos_hash_pair.second))
{
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]);
do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
if (p_next_e == NULL)
{
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();)
return false;
}
r_pos_hash_pair.second))
{
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);
do_resize_if_needed_no_throw();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it);
const_mapped_pointer p_mapped_value =
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)
return false;
resize_base::notify_insert_search_end();
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);
}
- _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);
}
resize_base::notify_insert_search_end();
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);
}
- _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);
}
--- /dev/null
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_map_base.hpp
+ * Contains a debug-mode base for all maps.
+ */
+
+#ifndef PB_DS_DEBUG_MAP_BASE_HPP
+#define PB_DS_DEBUG_MAP_BASE_HPP
+
+#ifdef _GLIBCXX_DEBUG
+
+#include <list>
+#include <utility>
+#include <cstdlib>
+#include <ext/throw_allocator.h>
+#include <debug/debug.h>
+
+namespace pb_ds
+{
+ 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 \
+ template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+
+#define PB_DS_CLASS_C_DEC \
+ debug_map_base<Key, Eq_Fn, Const_Key_Reference>
+
+ template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+ class debug_map_base
+ {
+ private:
+ typedef typename std::allocator< Key> key_allocator;
+
+ typedef typename key_allocator::size_type size_type;
+
+ typedef Const_Key_Reference const_key_reference;
+
+ protected:
+ debug_map_base();
+
+ debug_map_base(const PB_DS_CLASS_C_DEC& other);
+
+ ~debug_map_base();
+
+ inline void
+ insert_new(const_key_reference r_key);
+
+ inline void
+ erase_existing(const_key_reference r_key);
+
+ void
+ clear();
+
+ inline void
+ check_key_exists(const_key_reference r_key) const;
+
+ inline void
+ check_key_does_not_exist(const_key_reference r_key) const;
+
+ inline void
+ check_size(size_type size) const;
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ template<typename Cmp_Fn>
+ void
+ split(const_key_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
+
+ void
+ join(PB_DS_CLASS_C_DEC& other);
+
+ private:
+ typedef std::list< Key> key_set;
+ typedef typename key_set::iterator key_set_iterator;
+ typedef typename key_set::const_iterator const_key_set_iterator;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+ const_key_set_iterator
+ find(const_key_reference r_key) const;
+
+ key_set_iterator
+ find(const_key_reference r_key);
+
+ key_set m_key_set;
+ Eq_Fn m_eq;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ debug_map_base()
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ debug_map_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set)
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ~debug_map_base()
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ insert_new(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ __gnu_cxx::throw_allocator<char> alloc;
+ const double orig_throw_prob = alloc.get_throw_prob();
+ alloc.set_throw_prob(0);
+ if (find(r_key) != m_key_set.end())
+ {
+ std::cerr << "insert_new" << r_key << std::endl;
+ std::abort();
+ }
+
+ try
+ {
+ m_key_set.push_back(r_key);
+ }
+ catch(...)
+ {
+ std::cerr << "insert_new" << r_key << std::endl;
+ std::abort();
+ }
+ alloc.set_throw_prob(orig_throw_prob);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ erase_existing(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ key_set_iterator it = find(r_key);
+ if (it == m_key_set.end())
+ {
+ std::cerr << "erase_existing" << r_key << std::endl;
+ std::abort();
+ }
+ m_key_set.erase(it);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ clear()
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ m_key_set.clear();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ check_key_exists(const_key_reference r_key) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (find(r_key) == m_key_set.end())
+ {
+ std::cerr << "check_key_exists" << r_key << std::endl;
+ std::abort();
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ check_key_does_not_exist(const_key_reference r_key) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (find(r_key) != m_key_set.end())
+ {
+ using std::cerr;
+ using std::endl;
+ cerr << "check_key_does_not_exist" << r_key << endl;
+ std::abort();
+ }
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ check_size(size_type size) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ const size_type key_set_size = m_key_set.size();
+ if (size != key_set_size)
+ {
+ std::cerr << "check_size " << size
+ << " " << key_set_size << std::endl;
+ std::abort();
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ m_key_set.swap(other.m_key_set);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_key_set_iterator
+ PB_DS_CLASS_C_DEC::
+ find(const_key_reference r_key) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ typedef const_key_set_iterator iterator_type;
+ for (iterator_type it = m_key_set.begin(); it != m_key_set.end(); ++it)
+ if (m_eq(*it, r_key))
+ return it;
+ return m_key_set.end();
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::key_set_iterator
+ PB_DS_CLASS_C_DEC::
+ find(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ key_set_iterator it = m_key_set.begin();
+ while (it != m_key_set.end())
+ {
+ if (m_eq(*it, r_key))
+ return it;
+ ++it;
+ }
+ return it;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ assert_valid() const
+ {
+ const_key_set_iterator prime_it = m_key_set.begin();
+ while (prime_it != m_key_set.end())
+ {
+ const_key_set_iterator sec_it = prime_it;
+ ++sec_it;
+ while (sec_it != m_key_set.end())
+ {
+ _GLIBCXX_DEBUG_ASSERT(!m_eq(*sec_it, *prime_it));
+ _GLIBCXX_DEBUG_ASSERT(!m_eq(*prime_it, *sec_it));
+ ++sec_it;
+ }
+ ++prime_it;
+ }
+ }
+#endif
+
+ PB_DS_CLASS_T_DEC
+ template<typename Cmp_Fn>
+ void
+ PB_DS_CLASS_C_DEC::
+ split(const_key_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
+ {
+ __gnu_cxx::throw_allocator<char> alloc;
+ const double orig_throw_prob = alloc.get_throw_prob();
+ alloc.set_throw_prob(0);
+ other.clear();
+ key_set_iterator it = m_key_set.begin();
+ while (it != m_key_set.end())
+ if (cmp_fn(r_key, * it))
+ {
+ other.insert_new(*it);
+ it = m_key_set.erase(it);
+ }
+ else
+ ++it;
+ alloc.set_throw_prob(orig_throw_prob);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ join(PB_DS_CLASS_C_DEC& other)
+ {
+ __gnu_cxx::throw_allocator<char> alloc;
+ const double orig_throw_prob = alloc.get_throw_prob();
+ alloc.set_throw_prob(0);
+ key_set_iterator it = other.m_key_set.begin();
+ while (it != other.m_key_set.end())
+ {
+ insert_new(*it);
+ it = other.m_key_set.erase(it);
+ }
+ _GLIBCXX_DEBUG_ASSERT(other.m_key_set.empty());
+ alloc.set_throw_prob(orig_throw_prob);
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+} // namespace detail
+} // namespace pb_ds
+
+#endif
+
+#endif
+
PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
- map_debug_base(other),
+ debug_base(other),
#endif
hash_eq_fn_base(other),
resize_base(other),
ranged_probe_fn_base::swap(other);
hash_eq_fn_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(other.assert_valid());
}
entry* const p_e = m_entries + pos;
new (&p_e->m_value) mapped_value_type(r_val);
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);)
}
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_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);)
}
PB_DS_CLASS_C_DEC::
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);
}
case valid_entry_status:
{
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;
break;
}
case valid_entry_status:
{
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);
erase_entry(entry_pointer p_e)
{
_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_stat = erased_entry_status;
_GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);
case empty_entry_status:
{
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));
return false;
}
case empty_entry_status:
{
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));
return false;
}
#include <iostream>
#endif
#ifdef _GLIBCXX_DEBUG
-#include <ext/pb_ds/detail/map_debug_base.hpp>
+#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#include <debug/debug.h>
types_traits<Key, Mapped, Allocator, Store_Hash>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_MAP_DEBUG_BASE_C_DEC \
- map_debug_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
#endif
#ifdef PB_DS_DATA_TRUE_INDICATOR
typename Resize_Policy>
class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG
- protected PB_DS_MAP_DEBUG_BASE_C_DEC,
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy,
typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
#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
typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
p_e->m_stat = valid_entry_status;
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();)
return &p_e->m_value;
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();)
return &p_e->m_value;
if (p_e->m_stat != valid_entry_status)
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 insert_new_imp(value_type(key, mapped_type()),
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;
}
#endif
case empty_entry_status:
{
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;
}
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key))
{
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);
}
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();
return NULL;
}
case empty_entry_status:
{
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;
}
key, pos_hash_pair.second))
{
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);
}
break;
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();
return NULL;
}
#undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_PROBE_FN_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_V2F
#undef PB_DS_V2S
case empty_entry_status:
{
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;
}
break;
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
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;
}
break;
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);
}
- _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);
}
case empty_entry_status:
{
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) ?
std::make_pair(pos, pos_hash_pair.second) :
r_key, pos_hash_pair.second))
{
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);
}
break;
entry_pointer p_e =& m_entries[pos_hash_pair.first];
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);
}
- _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);
}
PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
- map_debug_base(),
+ debug_base(),
#endif
m_p_l(NULL)
{
{
_GLIBCXX_DEBUG_ONLY(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);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
size_type calc_size = 0;
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;
}
- map_debug_base::check_size(calc_size);
+ debug_base::check_size(calc_size);
}
#endif
PB_DS_CLASS_C_DEC::
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();
s_entry_allocator.deallocate(p_l, 1);
}
if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
{
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;
}
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;
}
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);
}
- _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->m_p_next = m_p_l;
value_type(r_val);
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);
return p_l;
}
{
entry_pointer p_l = s_entry_allocator.allocate(1);
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);
return p_l;
}
#include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp>
#include <ext/pb_ds/exception.hpp>
#ifdef _GLIBCXX_DEBUG
-#include <ext/pb_ds/detail/map_debug_base.hpp>
+#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#ifdef PB_DS_LU_MAP_TRACE_
#include <iostream>
types_traits<Key, Mapped, Allocator, false>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_MAP_DEBUG_BASE_C_DEC \
- map_debug_base<Key, Eq_Fn, \
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, Eq_Fn, \
typename Allocator::template rebind<Key>::other::const_reference>
#endif
class Update_Policy>
class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG
- protected PB_DS_MAP_DEBUG_BASE_C_DEC,
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public PB_DS_TYPES_TRAITS_C_DEC
{
#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
typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_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_V2F
#undef PB_DS_EP2VP
+++ /dev/null
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 2, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
-// MA 02111-1307, USA.
-
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file map_debug_base.hpp
- * Contains a debug-mode base for all maps.
- */
-
-#ifndef PB_DS_MAP_DEBUG_BASE_HPP
-#define PB_DS_MAP_DEBUG_BASE_HPP
-
-#ifdef _GLIBCXX_DEBUG
-
-#include <list>
-#include <utility>
-#include <cstdlib>
-#include <ext/throw_allocator.h>
-#include <debug/debug.h>
-
-namespace pb_ds
-{
- namespace detail
- {
-
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, class Eq_Fn, typename Const_Key_Reference>
-
-#define PB_DS_CLASS_C_DEC \
- map_debug_base<Key, Eq_Fn, Const_Key_Reference>
-
- template<typename Key, class Eq_Fn, typename Const_Key_Reference>
- class map_debug_base
- {
- private:
- typedef typename std::allocator< Key> key_allocator;
-
- typedef typename key_allocator::size_type size_type;
-
- typedef Const_Key_Reference const_key_reference;
-
- protected:
- map_debug_base();
-
- map_debug_base(const PB_DS_CLASS_C_DEC& other);
-
- ~map_debug_base();
-
- inline void
- insert_new(const_key_reference r_key);
-
- inline void
- erase_existing(const_key_reference r_key);
-
- void
- clear();
-
- inline void
- check_key_exists(const_key_reference r_key) const;
-
- inline void
- check_key_does_not_exist(const_key_reference r_key) const;
-
- inline void
- check_size(size_type size) const;
-
- void
- swap(PB_DS_CLASS_C_DEC& other);
-
- template<typename Cmp_Fn>
- void
- split(const_key_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
-
- void
- join(PB_DS_CLASS_C_DEC& other);
-
- private:
- typedef std::list< Key> key_set;
- typedef typename key_set::iterator key_set_iterator;
- typedef typename key_set::const_iterator const_key_set_iterator;
-
-#ifdef _GLIBCXX_DEBUG
- void
- assert_valid() const;
-#endif
-
- const_key_set_iterator
- find(const_key_reference r_key) const;
-
- key_set_iterator
- find(const_key_reference r_key);
-
- key_set m_key_set;
- Eq_Fn m_eq;
- };
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- map_debug_base()
- { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- map_debug_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set)
- { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- ~map_debug_base()
- { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- insert_new(const_key_reference r_key)
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- __gnu_cxx::throw_allocator<char> alloc;
- const double orig_throw_prob = alloc.get_throw_prob();
- alloc.set_throw_prob(0);
- if (find(r_key) != m_key_set.end())
- {
- std::cerr << "insert_new " << r_key << std::endl;
- std::abort();
- }
-
- try
- {
- m_key_set.push_back(r_key);
- }
- catch(...)
- {
- std::cerr << "insert_new 1" << r_key << std::endl;
- std::abort();
- }
- alloc.set_throw_prob(orig_throw_prob);
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- erase_existing(const_key_reference r_key)
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- key_set_iterator it = find(r_key);
- if (it == m_key_set.end())
- {
- std::cerr << "erase_existing " << r_key << std::endl;
- std::abort();
- }
- m_key_set.erase(it);
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- clear()
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- m_key_set.clear();
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- check_key_exists(const_key_reference r_key) const
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- if (find(r_key) == m_key_set.end())
- {
- std::cerr << "check_key_exists " << r_key << std::endl;
- std::abort();
- }
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- check_key_does_not_exist(const_key_reference r_key) const
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- if (find(r_key) != m_key_set.end())
- {
- std::cerr << "check_key_does_not_exist " << r_key << std::endl;
- std::abort();
- }
- }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- check_size(size_type size) const
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- const size_type key_set_size = m_key_set.size();
- if (size != key_set_size)
- {
- std::cerr << "check_size " << size
- << " " << key_set_size << std::endl;
- std::abort();
- }
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- swap(PB_DS_CLASS_C_DEC& other)
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- m_key_set.swap(other.m_key_set);
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::const_key_set_iterator
- PB_DS_CLASS_C_DEC::
- find(const_key_reference r_key) const
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- typedef const_key_set_iterator iterator_type;
- for (iterator_type it = m_key_set.begin(); it != m_key_set.end(); ++it)
- if (m_eq(*it, r_key))
- return it;
- return m_key_set.end();
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::key_set_iterator
- PB_DS_CLASS_C_DEC::
- find(const_key_reference r_key)
- {
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- key_set_iterator it = m_key_set.begin();
- while (it != m_key_set.end())
- {
- if (m_eq(*it, r_key))
- return it;
- ++it;
- }
- return it;
- _GLIBCXX_DEBUG_ONLY(assert_valid();)
- }
-
-#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- assert_valid() const
- {
- const_key_set_iterator prime_it = m_key_set.begin();
- while (prime_it != m_key_set.end())
- {
- const_key_set_iterator sec_it = prime_it;
- ++sec_it;
- while (sec_it != m_key_set.end())
- {
- _GLIBCXX_DEBUG_ASSERT(!m_eq(*sec_it, *prime_it));
- _GLIBCXX_DEBUG_ASSERT(!m_eq(*prime_it, *sec_it));
- ++sec_it;
- }
- ++prime_it;
- }
- }
-#endif
-
- PB_DS_CLASS_T_DEC
- template<typename Cmp_Fn>
- void
- PB_DS_CLASS_C_DEC::
- split(const_key_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
- {
- __gnu_cxx::throw_allocator<char> alloc;
- const double orig_throw_prob = alloc.get_throw_prob();
- alloc.set_throw_prob(0);
- other.clear();
- key_set_iterator it = m_key_set.begin();
- while (it != m_key_set.end())
- if (cmp_fn(r_key, * it))
- {
- other.insert_new(*it);
- it = m_key_set.erase(it);
- }
- else
- ++it;
- alloc.set_throw_prob(orig_throw_prob);
- }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- join(PB_DS_CLASS_C_DEC& other)
- {
- __gnu_cxx::throw_allocator<char> alloc;
- const double orig_throw_prob = alloc.get_throw_prob();
- alloc.set_throw_prob(0);
- key_set_iterator it = other.m_key_set.begin();
- while (it != other.m_key_set.end())
- {
- insert_new(*it);
- it = other.m_key_set.erase(it);
- }
- _GLIBCXX_DEBUG_ASSERT(other.m_key_set.empty());
- alloc.set_throw_prob(orig_throw_prob);
- }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
-} // namespace detail
-} // namespace pb_ds
-
-#endif
-
-#endif
-
PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
- map_debug_base(other),
+ debug_base(other),
#endif
#ifdef PB_DS_TREE_TRACE
PB_DS_TREE_TRACE_BASE_C_DEC(other),
const_iterator dbg_it = m_a_values;
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++;
}
PB_DS_CLASS_C_DEC::assert_valid();
const_iterator dbg_it = m_a_values;
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++;
}
PB_DS_CLASS_C_DEC::assert_valid();
std::swap(m_a_metadata, other.m_a_metadata);
std::swap(m_size, other.m_size);
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_C_DEC::
assert_iterators() const
{
- map_debug_base::check_size(m_size);
+ debug_base::check_size(m_size);
size_type iterated_num = 0;
const_iterator prev_it = end();
_GLIBCXX_DEBUG_ASSERT( m_end_it == m_a_values + m_size);
for (const_iterator it = begin(); it != end(); ++it)
{
++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);
const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
--upper_bound_it;
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_size = 0;
m_end_it = m_a_values;
value_vector a_new_values = s_value_alloc.allocate(new_size);
iterator target_it = a_new_values;
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)
{
if (!pred(*source_it))
new (const_cast<void*>(static_cast<const void* >(target_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;
}
}
#include <ext/pb_ds/tree_policy.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/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/exception.hpp>
#include <ext/pb_ds/detail/tree_trace_base.hpp>
types_traits<Key, Mapped, Allocator, false>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_MAP_DEBUG_BASE_C_DEC \
- map_debug_base<Key, eq_by_less<Key, Cmp_Fn>, \
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
typename Allocator::template rebind<Key>::other::const_reference>
#endif
class Node_And_It_Traits, class Allocator>
class PB_DS_OV_TREE_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG
- protected PB_DS_MAP_DEBUG_BASE_C_DEC,
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
#ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC,
typedef Cmp_Fn cmp_fn_base;
#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
typedef typename traits_base::pointer mapped_pointer_;
point_iterator it = lower_bound(r_key);
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();)
return it->second;
}
if (it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))
{
_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);
}
iterator pot_it = lower_bound(r_key);
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;
}
- _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;
}
iterator pot_it = lower_bound(r_key);
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;
}
- _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();
}
typename Allocator::group_throw_prob_adjustor adjust(m_size);
#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);
++m_size;
m_a_values = a_values;
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);
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
return ret_it;
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_OV_TREE_CLASS_NAME
#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
#undef PB_DS_TREE_TRACE_BASE_C_DEC
#endif
return;
}
- _GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)
+ _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
iterator it = upper_bound(r_key);
PB_DS_CLASS_C_DEC new_other(other, other);
new_other.copy_from_ordered_range(it, end());
new_this.copy_from_ordered_range(begin(), it);
// 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));
update(node_begin(), (node_update* )this);
other.value_swap(new_other);
begin(), end());
// No exceptions from this point.
- _GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)
+ _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
value_swap(new_this);
other.clear();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
- map_debug_base(other),
+ debug_base(other),
#endif
synth_e_access_traits(other),
node_update(other),
PB_DS_CLASS_C_DEC::
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_size, other.m_size);
}
for (const_iterator it = begin(); it != end(); ++it)
{
++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(--upper_bound(PB_DS_V2F(*it)) == it);
}
node_pointer p_nd = find_imp(r_key);
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;
}
_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))
{
- _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;
}
- _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));
_GLIBCXX_DEBUG_ONLY(assert_valid();)
return true;
clear_imp(m_p_head->m_p_parent);
m_size = 0;
initialize();
- _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
}
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();
}
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);
}
- _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();
}
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();
}
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));
}
- _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();
}
__throw_join_error();
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;
}
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)))
{
- _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();)
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);
cond_dealtor cond(p_new_lf);
cond.set_no_action_dtor();
++m_size;
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();)
return std::make_pair(point_iterator(p_new_lf), true);
}
#include <assert.h>
#include <list>
#ifdef _GLIBCXX_DEBUG
-#include <ext/pb_ds/detail/map_debug_base.hpp>
+#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#include <debug/debug.h>
types_traits<Key, Mapped, Allocator, false>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_MAP_DEBUG_BASE_C_DEC \
- map_debug_base<Key, eq_by_less<Key, \
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, eq_by_less<Key, \
std::less<Key> >, typename Allocator::template rebind<Key>::other::const_reference>
#endif
typename Allocator>
class PB_DS_CLASS_NAME :
#ifdef _GLIBCXX_DEBUG
- public PB_DS_MAP_DEBUG_BASE_C_DEC,
+ public PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public Node_And_It_Traits::synth_e_access_traits,
public Node_And_It_Traits::node_update,
#include <ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp>
#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
#include <ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp>
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_NAME
#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_EP2VP
#undef PB_DS_V2S
clear_imp(m_p_head->m_p_parent);
m_size = 0;
initialize();
- _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)
}
r_bag.add_branch();
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);
}
{
m_resize_needed = false;
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)
{
_GLIBCXX_DEBUG_ASSERT(new_shrink_size > m_next_shrink_size);
typedef typename Alloc::size_type size_type;
// 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;
- typename no_throw_copies<Key, Mapped>::indicator m_no_throw_copies_indicator;
+ typedef integral_constant<int, Store_Extra> store_extra;
+ 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 pb_ds
#include <ext/pb_ds/detail/type_utils.hpp>
+/**
+ * @namespace pb_ds
+ * @brief GNU extension policy-based data structures for public use.
+ */
+
namespace pb_ds
{
// A trivial iterator tag. Signifies that the iterators has none of