+2011-06-10 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/ext/pb_ds/*: Doxygen markup redo.
+ * include/Makefile.am: Fold in constructors_destructor_fn_imps.hpp.
+ * include/Makefile.in: Regenerate.
+
2011-06-10 Jason Merrill <jason@redhat.com>
* testsuite/20_util/bind/ref_neg.cc: Remove wrong test lines.
pb_headers3 = \
${pb_srcdir}/detail/cc_hash_table_map_/trace_fn_imps.hpp \
${pb_srcdir}/detail/cond_dealtor.hpp \
- ${pb_srcdir}/detail/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/container_base_dispatch.hpp \
${pb_srcdir}/detail/eq_fn/eq_by_less.hpp \
${pb_srcdir}/detail/eq_fn/hash_eq_fn.hpp \
pb_headers3 = \
${pb_srcdir}/detail/cc_hash_table_map_/trace_fn_imps.hpp \
${pb_srcdir}/detail/cond_dealtor.hpp \
- ${pb_srcdir}/detail/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/container_base_dispatch.hpp \
${pb_srcdir}/detail/eq_fn/eq_by_less.hpp \
${pb_srcdir}/detail/eq_fn/hash_eq_fn.hpp \
namespace __gnu_pbds
{
/**
- * @addtogroup pbds
+ * @defgroup containers-pbds Containers
+ * @ingroup pbds
* @{
*/
+ /**
+ * @defgroup hash-based
+ * @ingroup containers-pbds
+ * @{
+ */
#define PB_DS_HASH_BASE \
detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, \
typename __gnu_cxx::typelist::append< \
typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, \
detail::integral_constant<int, Store_Hash> >::type, Policy_Tl>::type>::type
- /// An abstract basic hash-based associative container.
+ /**
+ * @defgroup hash-detail Base and Policy Classes
+ * @ingroup hash-based
+ */
+
+ /**
+ * A hashed container abstraction.
+ *
+ * @tparam Key Key type.
+ * @tparam Mapped Map type.
+ * @tparam Hash_Fn Hashing functor.
+ * @tparam Eq_Fn Equal functor.
+ * @tparam Resize_Policy Resizes hash.
+ * @tparam Store_Hash Indicates whether the hash value
+ * will be stored along with each key.
+ * @tparam Tag Instantiating data structure type,
+ * see container_tag.
+ * @tparam Policy_TL Policy typelist.
+ * @tparam _Alloc Allocator type.
+ *
+ * Base is dispatched at compile time via Tag, from the following
+ * choices: cc_hash_tag, gp_hash_tag, and descendants of basic_hash_tag.
+ *
+ * Base choices are: detail::cc_ht_map, detail::gp_ht_map
+ */
template<typename Key,
typename Mapped,
typename Hash_Fn,
~basic_hash_table() { }
protected:
-#define PB_DS_CLASS_NAME basic_hash_table
-#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>
-#undef PB_DS_CLASS_NAME
+ basic_hash_table() { }
+
+ basic_hash_table(const basic_hash_table& other)
+ : base_type((const base_type&)other) { }
+
+ template<typename T0>
+ basic_hash_table(T0 t0) : base_type(t0) { }
+
+ template<typename T0, typename T1>
+ basic_hash_table(T0 t0, T1 t1) : base_type(t0, t1) { }
+
+ template<typename T0, typename T1, typename T2>
+ basic_hash_table(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { }
+
+ template<typename T0, typename T1, typename T2, typename T3>
+ basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3)
+ : base_type(t0, t1, t2, t3) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4>
+ basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)
+ : base_type(t0, t1, t2, t3, t4) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5>
+ basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
+ : base_type(t0, t1, t2, t3, t4, t5) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6>
+ basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
+ : base_type(t0, t1, t2, t3, t4, t5, t6) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6, typename T7>
+ basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
+ : base_type(t0, t1, t2, t3, t4, t5, t6, t7) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6, typename T7, typename T8>
+ basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6,
+ T7 t7, T8 t8)
+ : base_type(t0, t1, t2, t3, t4, t5, t6, t7, t8)
+ { }
private:
basic_hash_table&
cc_hash_tag, \
typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, _Alloc>
- /// A concrete collision-chaining hash-based associative container.
+
+ /**
+ * A collision-chaining hash-based associative container.
+ *
+ * @tparam Key Key type.
+ * @tparam Mapped Map type.
+ * @tparam Hash_Fn Hashing functor.
+ * @tparam Eq_Fn Equal functor.
+ * @tparam Comb_Hash_Fn Combining hash functor.
+ * If Hash_Fn is not null_type, then this
+ * is the ranged-hash functor; otherwise,
+ * this is the range-hashing functor.
+ * XXX(See Design::Hash-Based Containers::Hash Policies.)
+ * @tparam Resize_Policy Resizes hash.
+ * @tparam Store_Hash Indicates whether the hash value
+ * will be stored along with each key.
+ * If Hash_Fn is null_type, then the
+ * container will not compile if this
+ * value is true
+ * @tparam _Alloc Allocator type.
+ *
+ * Base tag choices are: cc_hash_tag.
+ *
+ * Base is basic_hash_table.
+ */
template<typename Key,
typename Mapped,
typename Hash_Fn = typename detail::default_hash_fn<Key>::type,
typedef Resize_Policy resize_policy;
typedef Comb_Hash_Fn comb_hash_fn;
- // Default constructor.
+ /// Default constructor.
cc_hash_table() { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the Hash_Fn object of the container object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the Hash_Fn object of the container object.
cc_hash_table(const hash_fn& h)
: base_type(h) { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object, and
- // r_eq_fn will be copied by the eq_fn object of the container
- // object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object, and
+ /// r_eq_fn will be copied by the eq_fn object of the container
+ /// object.
cc_hash_table(const hash_fn& h, const eq_fn& e)
: base_type(h, e) { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object, r_eq_fn
- // will be copied by the eq_fn object of the container object, and
- // r_comb_hash_fn will be copied by the comb_hash_fn object of the
- // container object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object, r_eq_fn
+ /// will be copied by the eq_fn object of the container object,
+ /// and r_comb_hash_fn will be copied by the comb_hash_fn object
+ /// of the container object.
cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch)
: base_type(h, e, ch) { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object, r_eq_fn
- // will be copied by the eq_fn object of the container object,
- // r_comb_hash_fn will be copied by the comb_hash_fn object of the
- // container object, and r_resize_policy will be copied by the
- // resize_policy object of the container object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object, r_eq_fn
+ /// will be copied by the eq_fn object of the container object,
+ /// r_comb_hash_fn will be copied by the comb_hash_fn object of
+ /// the container object, and r_resize_policy will be copied by
+ /// the resize_policy object of the container object.
cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch,
const resize_policy& rp)
: base_type(h, e, ch, rp) { }
- // Constructor taking __iterators to a range of value_types. The
- // value_types between first_it and last_it will be inserted into
- // the container object.
+ /// Constructor taking __iterators to a range of value_types. The
+ /// value_types between first_it and last_it will be inserted into
+ /// the container object.
template<typename It>
cc_hash_table(It first, It last)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects. The value_types between first_it and
- // last_it will be inserted into the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects. The value_types between first_it and
+ /// last_it will be inserted into the container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h)
: base_type(h)
{ this->copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object,
- // and r_eq_fn will be copied by the eq_fn object of the container
- // object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object,
+ /// and r_eq_fn will be copied by the eq_fn object of the
+ /// container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)
: base_type(h, e)
{ this->copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object,
- // r_eq_fn will be copied by the eq_fn object of the container
- // object, and r_comb_hash_fn will be copied by the comb_hash_fn
- // object of the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object,
+ /// r_eq_fn will be copied by the eq_fn object of the container
+ /// object, and r_comb_hash_fn will be copied by the comb_hash_fn
+ /// object of the container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_hash_fn& ch)
: base_type(h, e, ch)
{ this->copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object,
- // r_eq_fn will be copied by the eq_fn object of the container
- // object, r_comb_hash_fn will be copied by the comb_hash_fn
- // object of the container object, and r_resize_policy will be
- // copied by the resize_policy object of the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object,
+ /// r_eq_fn will be copied by the eq_fn object of the container
+ /// object, r_comb_hash_fn will be copied by the comb_hash_fn
+ /// object of the container object, and r_resize_policy will be
+ /// copied by the resize_policy object of the container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_hash_fn& ch, const resize_policy& rp)
gp_hash_tag, \
typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, _Alloc>
- /// A concrete general-probing hash-based associative container.
+
+ /**
+ * A general-probing hash-based associative container.
+ *
+ * @tparam Key Key type.
+ * @tparam Mapped Map type.
+ * @tparam Hash_Fn Hashing functor.
+ * @tparam Eq_Fn Equal functor.
+ * @tparam Comb_Probe_Fn Combining probe functor.
+ * If Hash_Fn is not null_type, then this
+ * is the ranged-probe functor; otherwise,
+ * this is the range-hashing functor.
+ * XXX See Design::Hash-Based Containers::Hash Policies.
+ * @tparam Probe_Fn Probe functor.
+ * @tparam Resize_Policy Resizes hash.
+ * @tparam Store_Hash Indicates whether the hash value
+ * will be stored along with each key.
+ * If Hash_Fn is null_type, then the
+ * container will not compile if this
+ * value is true
+ * @tparam _Alloc Allocator type.
+ *
+ * Base tag choices are: gp_hash_tag.
+ *
+ * Base is basic_hash_table.
+ */
template<typename Key,
typename Mapped,
typename Hash_Fn = typename detail::default_hash_fn<Key>::type,
typedef Probe_Fn probe_fn;
typedef Resize_Policy resize_policy;
- // Default constructor.
+ /// Default constructor.
gp_hash_table() { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object.
gp_hash_table(const hash_fn& h)
: base_type(h) { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object, and
- // r_eq_fn will be copied by the eq_fn object of the container
- // object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object, and
+ /// r_eq_fn will be copied by the eq_fn object of the container
+ /// object.
gp_hash_table(const hash_fn& h, const eq_fn& e)
: base_type(h, e) { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object, r_eq_fn
- // will be copied by the eq_fn object of the container object, and
- // r_comb_probe_fn will be copied by the comb_probe_fn object of
- // the container object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object, r_eq_fn
+ /// will be copied by the eq_fn object of the container object,
+ /// and r_comb_probe_fn will be copied by the comb_probe_fn object
+ /// of the container object.
gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp)
: base_type(h, e, cp) { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object, r_eq_fn
- // will be copied by the eq_fn object of the container object,
- // r_comb_probe_fn will be copied by the comb_probe_fn object of
- // the container object, and r_probe_fn will be copied by the
- // probe_fn object of the container object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object, r_eq_fn
+ /// will be copied by the eq_fn object of the container object,
+ /// r_comb_probe_fn will be copied by the comb_probe_fn object of
+ /// the container object, and r_probe_fn will be copied by the
+ /// probe_fn object of the container object.
gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,
const probe_fn& p)
: base_type(h, e, cp, p) { }
- // Constructor taking some policy objects. r_hash_fn will be
- // copied by the hash_fn object of the container object, r_eq_fn
- // will be copied by the eq_fn object of the container object,
- // r_comb_probe_fn will be copied by the comb_probe_fn object of
- // the container object, r_probe_fn will be copied by the probe_fn
- // object of the container object, and r_resize_policy will be
- // copied by the Resize_Policy object of the container object.
+ /// Constructor taking some policy objects. r_hash_fn will be
+ /// copied by the hash_fn object of the container object, r_eq_fn
+ /// will be copied by the eq_fn object of the container object,
+ /// r_comb_probe_fn will be copied by the comb_probe_fn object of
+ /// the container object, r_probe_fn will be copied by the
+ /// probe_fn object of the container object, and r_resize_policy
+ /// will be copied by the Resize_Policy object of the container
+ /// object.
gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,
const probe_fn& p, const resize_policy& rp)
: base_type(h, e, cp, p, rp) { }
- // Constructor taking __iterators to a range of value_types. The
- // value_types between first_it and last_it will be inserted into
- // the container object.
+ /// Constructor taking __iterators to a range of value_types. The
+ /// value_types between first_it and last_it will be inserted into
+ /// the container object.
template<typename It>
gp_hash_table(It first, It last)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects. The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects. The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h)
: base_type(h)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects. The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object,
- // and r_eq_fn will be copied by the eq_fn object of the container
- // object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects. The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object,
+ /// and r_eq_fn will be copied by the eq_fn object of the
+ /// container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)
: base_type(h, e)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects. The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object,
- // r_eq_fn will be copied by the eq_fn object of the container
- // object, and r_comb_probe_fn will be copied by the comb_probe_fn
- // object of the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects. The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object,
+ /// r_eq_fn will be copied by the eq_fn object of the container
+ /// object, and r_comb_probe_fn will be copied by the
+ /// comb_probe_fn object of the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_probe_fn& cp)
: base_type(h, e, cp)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects. The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object,
- // r_eq_fn will be copied by the eq_fn object of the container
- // object, r_comb_probe_fn will be copied by the comb_probe_fn
- // object of the container object, and r_probe_fn will be copied
- // by the probe_fn object of the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects. The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object,
+ /// r_eq_fn will be copied by the eq_fn object of the container
+ /// object, r_comb_probe_fn will be copied by the comb_probe_fn
+ /// object of the container object, and r_probe_fn will be copied
+ /// by the probe_fn object of the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_probe_fn& cp, const probe_fn& p)
: base_type(h, e, cp, p)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects. The value_types between first_it and
- // last_it will be inserted into the container object. r_hash_fn
- // will be copied by the hash_fn object of the container object,
- // r_eq_fn will be copied by the eq_fn object of the container
- // object, r_comb_probe_fn will be copied by the comb_probe_fn
- // object of the container object, r_probe_fn will be copied by
- // the probe_fn object of the container object, and
- // r_resize_policy will be copied by the resize_policy object of
- // the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects. The value_types between first_it and
+ /// last_it will be inserted into the container object. r_hash_fn
+ /// will be copied by the hash_fn object of the container object,
+ /// r_eq_fn will be copied by the eq_fn object of the container
+ /// object, r_comb_probe_fn will be copied by the comb_probe_fn
+ /// object of the container object, r_probe_fn will be copied by
+ /// the probe_fn object of the container object, and
+ /// r_resize_policy will be copied by the resize_policy object of
+ /// the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_probe_fn& cp, const probe_fn& p,
swap(gp_hash_table& other)
{ base_type::swap(other); }
};
-
+ //@} hash-based
#undef PB_DS_GP_HASH_BASE
+
+ /**
+ * @defgroup branch-based
+ * @ingroup containers-pbds
+ * @{
+ */
#define PB_DS_BRANCH_BASE \
detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, Policy_Tl>::type
- /// An abstract basic tree-like (tree, trie) associative container.
+ /**
+ * @defgroup branch-detail Base and Policy Classes
+ * @ingroup branch-based
+ */
+
+ /**
+ * A branched, tree-like (tree, trie) container abstraction.
+ *
+ * @tparam Key Key type.
+ * @tparam Mapped Map type.
+ * @tparam Tag Instantiating data structure type,
+ * see container_tag.
+ * @tparam Node_Update Updates nodes, restores invariants.
+ * @tparam Policy_TL Policy typelist.
+ * @tparam _Alloc Allocator type.
+ *
+ * Base is dispatched at compile time via Tag, from the following
+ * choices: tree_tag, trie_tag, and their descendants.
+ *
+ * Base choices are: detail::ov_tree_map, detail::rb_tree_map,
+ * detail::splay_tree_map, and detail::pat_trie_map.
+ */
template<typename Key, typename Mapped, typename Tag,
typename Node_Update, typename Policy_Tl, typename _Alloc>
class basic_branch : public PB_DS_BRANCH_BASE
~basic_branch() { }
protected:
-#define PB_DS_CLASS_NAME basic_branch
-#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>
-#undef PB_DS_CLASS_NAME
- };
+ basic_branch() { }
+
+ basic_branch(const basic_branch& other)
+ : base_type((const base_type&)other) { }
+ template<typename T0>
+ basic_branch(T0 t0) : base_type(t0) { }
+
+ template<typename T0, typename T1>
+ basic_branch(T0 t0, T1 t1) : base_type(t0, t1) { }
+
+ template<typename T0, typename T1, typename T2>
+ basic_branch(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { }
+
+ template<typename T0, typename T1, typename T2, typename T3>
+ basic_branch(T0 t0, T1 t1, T2 t2, T3 t3)
+ : base_type(t0, t1, t2, t3) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4>
+ basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)
+ : base_type(t0, t1, t2, t3, t4) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5>
+ basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
+ : base_type(t0, t1, t2, t3, t4, t5) { }
+
+ template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6>
+ basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
+ : base_type(t0, t1, t2, t3, t4, t5, t6) { }
+ };
#undef PB_DS_BRANCH_BASE
typename __gnu_cxx::typelist::create2<Cmp_Fn, \
PB_DS_TREE_NODE_AND_IT_TRAITS>::type, _Alloc>
- /// A basic tree-based associative container.
+
+ /**
+ * A tree-based container.
+ *
+ * @tparam Key Key type.
+ * @tparam Mapped Map type.
+ * @tparam Cmp_Fn Comparison functor.
+ * @tparam Tag Instantiating data structure type,
+ * see container_tag.
+ * @tparam Node_Update Updates nodes,
+ * restores invariants when invalidated.
+ * XXX See design::tree-based-containers::node invariants.
+ * @tparam _Alloc Allocator type.
+ *
+ * Base tag choices are: ov_tree_tag, rb_tree_tag, splay_tree_tag.
+ *
+ * Base is basic_branch.
+ */
template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
typename Tag = rb_tree_tag,
template<typename Node_CItr, typename Node_Itr,
typedef PB_DS_TREE_BASE base_type;
public:
- // Comparison functor type.
+ /// Comparison functor type.
typedef Cmp_Fn cmp_fn;
tree() { }
- // Constructor taking some policy objects. r_cmp_fn will be copied
- // by the Cmp_Fn object of the container object.
+ /// Constructor taking some policy objects. r_cmp_fn will be
+ /// copied by the Cmp_Fn object of the container object.
tree(const cmp_fn& c)
: base_type(c) { }
- // Constructor taking __iterators to a range of value_types. The
- // value_types between first_it and last_it will be inserted into
- // the container object.
+ /// Constructor taking __iterators to a range of value_types. The
+ /// value_types between first_it and last_it will be inserted into
+ /// the container object.
template<typename It>
tree(It first, It last)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects The value_types between first_it and
- // last_it will be inserted into the container object. r_cmp_fn
- // will be copied by the cmp_fn object of the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects The value_types between first_it and
+ /// last_it will be inserted into the container object. r_cmp_fn
+ /// will be copied by the cmp_fn object of the container object.
template<typename It>
tree(It first, It last, const cmp_fn& c)
- : base_type(c)
+ : base_type(c)
{ base_type::copy_from_range(first, last); }
tree(const tree& other)
typename __gnu_cxx::typelist::create2<_ATraits, \
PB_DS_TRIE_NODE_AND_IT_TRAITS >::type, _Alloc>
- /// A basic trie-based associative container.
+
+ /**
+ * A trie-based container.
+ *
+ * @tparam Key Key type.
+ * @tparam Mapped Map type.
+ * @tparam _ATraits Element access traits.
+ * @tparam Tag Instantiating data structure type,
+ * see container_tag.
+ * @tparam Node_Update Updates nodes,
+ * restores invariants when invalidated.
+ * XXX See design::tree-based-containers::node invariants.
+ * @tparam _Alloc Allocator type.
+ *
+ * Base tag choice is pat_trie_tag.
+ *
+ * Base is basic_branch.
+ */
template<typename Key,
typename Mapped,
typename _ATraits = \
typedef PB_DS_TRIE_BASE base_type;
public:
- // Element access traits type.
+ /// Element access traits type.
typedef _ATraits access_traits;
trie() { }
- // Constructor taking some policy objects. r_access_traits will
- // be copied by the _ATraits object of the container
- // object.
+ /// Constructor taking some policy objects. r_access_traits will
+ /// be copied by the _ATraits object of the container object.
trie(const access_traits& t)
: base_type(t) { }
- // Constructor taking __iterators to a range of value_types. The
- // value_types between first_it and last_it will be inserted into
- // the container object.
+ /// Constructor taking __iterators to a range of value_types. The
+ /// value_types between first_it and last_it will be inserted into
+ /// the container object.
template<typename It>
trie(It first, It last)
{ base_type::copy_from_range(first, last); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects. The value_types between first_it and
- // last_it will be inserted into the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects. The value_types between first_it and
+ /// last_it will be inserted into the container object.
template<typename It>
trie(It first, It last, const access_traits& t)
: base_type(t)
swap(trie& other)
{ base_type::swap(other); }
};
-
+ //@} branch-based
#undef PB_DS_TRIE_BASE
#undef PB_DS_TRIE_NODE_AND_IT_TRAITS
+ /**
+ * @defgroup list-based
+ * @ingroup containers-pbds
+ * @{
+ */
#define PB_DS_LU_BASE \
detail::container_base_dispatch<Key, Mapped, _Alloc, list_update_tag, \
typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type>::type
- /// A list-update based associative container.
+
+ /**
+ * A list-update based associative container.
+ *
+ * @tparam Key Key type.
+ * @tparam Mapped Map type.
+ * @tparam Eq_Fn Equal functor.
+ * @tparam Update_Policy Update policy, determines when an element
+ * will be moved to the front of the list.
+ * @tparam _Alloc Allocator type.
+ *
+ * Base is detail::lu_map.
+ */
template<typename Key,
typename Mapped,
class Eq_Fn = typename detail::default_eq_fn<Key>::type,
list_update() { }
- // Constructor taking __iterators to a range of value_types. The
- // value_types between first_it and last_it will be inserted into
- // the container object.
+ /// Constructor taking __iterators to a range of value_types. The
+ /// value_types between first_it and last_it will be inserted into
+ /// the container object.
template<typename It>
list_update(It first, It last)
{ base_type::copy_from_range(first, last); }
swap(list_update& other)
{ base_type::swap(other); }
};
-
+ //@} list-based
#undef PB_DS_LU_BASE
- // @} group pbds
+ // @} group containers-pbds
} // namespace __gnu_pbds
#endif
+++ /dev/null
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// 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 basic_tree_policy_base.hpp
- * Contains a base class for tree_like policies.
- */
-
-#ifndef PB_DS_TREE_LIKE_POLICY_BASE_HPP
-#define PB_DS_TREE_LIKE_POLICY_BASE_HPP
-
-namespace __gnu_pbds
-{
- namespace detail
- {
-
-#define PB_DS_CLASS_C_DEC \
- basic_tree_policy_base< \
- Const_Node_Iterator, \
- Node_Iterator, \
- Allocator>
-
- template<typename Const_Node_Iterator,
- typename Node_Iterator,
- typename Allocator>
- struct basic_tree_policy_base
- {
- protected:
- typedef typename Node_Iterator::value_type it_type;
-
- typedef typename std::iterator_traits< it_type>::value_type value_type;
-
- typedef typename value_type::first_type key_type;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- key_type>::type>::other::const_reference
- const_key_reference;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- value_type>::type>::other::const_reference
- const_reference;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- value_type>::type>::other::reference
- reference;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- value_type>::type>::other::const_pointer
- const_pointer;
-
- static inline const_key_reference
- extract_key(const_reference r_val)
- {
- return (r_val.first);
- }
-
- virtual it_type
- end() = 0;
-
- it_type
- end_iterator() const
- {
- return (const_cast<PB_DS_CLASS_C_DEC* >(this)->end());
- }
-
- virtual
- ~basic_tree_policy_base()
- { }
- };
-
- template<typename Const_Node_Iterator, typename Allocator>
- struct basic_tree_policy_base<
- Const_Node_Iterator,
- Const_Node_Iterator,
- Allocator>
- {
- protected:
- typedef typename Const_Node_Iterator::value_type it_type;
-
- typedef typename std::iterator_traits< it_type>::value_type value_type;
-
- typedef value_type key_type;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- key_type>::type>::other::const_reference
- const_key_reference;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- value_type>::type>::other::const_reference
- const_reference;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- value_type>::type>::other::reference
- reference;
-
- typedef
- typename Allocator::template rebind<
- typename remove_const<
- value_type>::type>::other::const_pointer
- const_pointer;
-
- static inline const_key_reference
- extract_key(const_reference r_val)
- {
- return (r_val);
- }
-
- virtual it_type
- end() const = 0;
-
- it_type
- end_iterator() const
- {
- return (end());
- }
-
- virtual
- ~basic_tree_policy_base()
- { }
- };
-
-#undef PB_DS_CLASS_C_DEC
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif // #ifndef PB_DS_TREE_LIKE_POLICY_BASE_HPP
+++ /dev/null
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// 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 null_node_metadata.hpp
- * Contains an implementation class for tree-like classes.
- */
-
-#ifndef PB_DS_0_NODE_METADATA_HPP
-#define PB_DS_0_NODE_METADATA_HPP
-
-#include <ext/pb_ds/detail/types_traits.hpp>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
- template<typename Key, class Data, class Allocator>
- struct dumconst_node_iterator
- {
- private:
- typedef typename types_traits<Key, Data, Allocator, false>::pointer const_iterator;
-
- public:
- typedef const_iterator value_type;
- typedef const_iterator const_reference;
- typedef const_reference reference;
- };
-
- struct null_node_metadata
- { };
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
+++ /dev/null
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// 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 traits.hpp
- * Contains an implementation class for tree-like classes.
- */
-
-#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
-#define PB_DS_NODE_AND_IT_TRAITS_HPP
-
-#define PB_DS_DEBUG_VERIFY(_Cond) \
- _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \
- _M_message(#_Cond" assertion from %1;:%2;") \
- ._M_string(__FILE__)._M_integer(__LINE__) \
- ,__file,__line)
-
-#include <ext/pb_ds/detail/types_traits.hpp>
-#include <ext/pb_ds/detail/bin_search_tree_/traits.hpp>
-#include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp>
-#include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
- template<typename Key,
- typename Data,
- class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class Cmp_Fn_,
- class Allocator>
- class Node_Update,
- class Tag,
- class Allocator>
- struct tree_traits;
-
- template<typename Key,
- typename Data,
- class E_Access_Traits,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class E_Access_Traits_,
- class Allocator>
- class Node_Update,
- class Tag,
- class Allocator>
- struct trie_traits;
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#include <ext/pb_ds/detail/rb_tree_map_/traits.hpp>
-#include <ext/pb_ds/detail/splay_tree_/traits.hpp>
-#include <ext/pb_ds/detail/ov_tree_map_/traits.hpp>
-#include <ext/pb_ds/detail/pat_trie_/traits.hpp>
-#undef PB_DS_DEBUG_VERIFY
-
-#endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
inline const_reverse_iterator
rend() const;
+ /// Returns a const node_iterator corresponding to the node at the
+ /// root of the tree.
inline node_const_iterator
node_begin() const;
+ /// Returns a node_iterator corresponding to the node at the
+ /// root of the tree.
inline node_iterator
node_begin();
+ /// Returns a const node_iterator corresponding to a node just
+ /// after a leaf of the tree.
inline node_const_iterator
node_end() const;
+ /// Returns a node_iterator corresponding to a node just
+ /// after a leaf of the tree.
inline node_iterator
node_end();
{
namespace detail
{
-#define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC \
- bin_search_tree_const_node_it_< \
- Node, \
- Const_Iterator, \
- Iterator, \
- _Alloc>
+#define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC \
+ bin_search_tree_const_node_it_<Node, Const_Iterator, Iterator, _Alloc>
/// Const node iterator.
template<typename Node,
node_pointer;
public:
- // Category.
+ /// Category.
typedef trivial_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef trivial_iterator_difference_type difference_type;
- // __Iterator's value type.
+ /// Iterator's value type.
typedef Const_Iterator value_type;
- // __Iterator's reference type.
+ /// Iterator's reference type.
typedef Const_Iterator reference;
- // __Iterator's __const reference type.
+ /// Iterator's __const reference type.
typedef Const_Iterator const_reference;
- // Metadata type.
+ /// Metadata type.
typedef typename Node::metadata_type metadata_type;
- // Const metadata reference type.
+ /// Const metadata reference type.
typedef
- typename _Alloc::template rebind<
- metadata_type>::other::const_reference
+ typename _Alloc::template rebind<metadata_type>::other::const_reference
metadata_const_reference;
- // Default constructor.
- /*
- inline
- bin_search_tree_const_node_it_()
- */
- inline
- bin_search_tree_const_node_it_(const node_pointer p_nd = 0)
+ bin_search_tree_const_node_it_(const node_pointer p_nd = 0)
: m_p_nd(const_cast<node_pointer>(p_nd))
{ }
- // Access.
- inline const_reference
+ /// Access.
+ const_reference
operator*() const
- {
- return (Const_Iterator(m_p_nd));
- }
+ { return Const_Iterator(m_p_nd); }
- // Metadata access.
- inline metadata_const_reference
+ /// Metadata access.
+ metadata_const_reference
get_metadata() const
- {
- return (m_p_nd->get_metadata());
- }
+ { return m_p_nd->get_metadata(); }
- // Returns the __const node iterator associated with the left node.
- inline PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
+ /// Returns the __const node iterator associated with the left node.
+ PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
get_l_child() const
- {
- return (PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_left));
- }
+ { return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_left); }
- // Returns the __const node iterator associated with the right node.
- inline PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
+ /// Returns the __const node iterator associated with the right node.
+ PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
get_r_child() const
- {
- return (PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_right));
- }
+ { return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_right); }
- // Compares to a different iterator object.
- inline bool
+ /// Compares to a different iterator object.
+ bool
operator==(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const
- {
- return (m_p_nd == other.m_p_nd);
- }
+ { return m_p_nd == other.m_p_nd; }
- // Compares (negatively) to a different iterator object.
- inline bool
+ /// Compares (negatively) to a different iterator object.
+ bool
operator!=(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const
- {
- return (m_p_nd != other.m_p_nd);
- }
+ { return m_p_nd != other.m_p_nd; }
node_pointer m_p_nd;
};
-#define PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC \
- bin_search_tree_node_it_< \
- Node, \
- Const_Iterator, \
- Iterator, \
- _Alloc>
+#define PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC \
+ bin_search_tree_node_it_<Node, Const_Iterator, Iterator, _Alloc>
/// Node iterator.
template<typename Node,
class Const_Iterator,
class Iterator,
typename _Alloc>
- class bin_search_tree_node_it_
+ class bin_search_tree_node_it_
: public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
{
private:
node_pointer;
public:
- // __Iterator's value type.
+ /// Iterator's value type.
typedef Iterator value_type;
- // __Iterator's reference type.
+ /// Iterator's reference type.
typedef Iterator reference;
- // __Iterator's __const reference type.
+ /// Iterator's __const reference type.
typedef Iterator const_reference;
- // Default constructor.
- /*
- inline
- bin_search_tree_node_it_();
- */
-
inline
- bin_search_tree_node_it_(const node_pointer p_nd = 0)
+ bin_search_tree_node_it_(const node_pointer p_nd = 0)
: PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(const_cast<node_pointer>(p_nd))
{ }
- // Access.
- inline Iterator
+ /// Access.
+ Iterator
operator*() const
- {
- return (Iterator(PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd));
- }
+ { return Iterator(PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd); }
- // Returns the node iterator associated with the left node.
- inline PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
+ /// Returns the node iterator associated with the left node.
+ PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
get_l_child() const
{
- return (PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
- PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_left));
+ return PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
+ PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_left);
}
- // Returns the node iterator associated with the right node.
- inline PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
+ /// Returns the node iterator associated with the right node.
+ PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
get_r_child() const
{
- return (PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
- PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_right));
+ return PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
+ PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_right);
}
};
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP
-
{
namespace detail
{
- /// Binary search tree traits, primary template.
+ /// Binary search tree traits, primary template
+ /// @ingroup traits
template<typename Key,
typename Mapped,
class Cmp_Fn,
class Node_Itr,
class Cmp_Fn,
typename _Alloc>
- class Node_Update,
+ class Node_Update,
class Node,
typename _Alloc>
struct bin_search_tree_traits
_Alloc>
reverse_iterator;
+ /// This is an iterator to an iterator: it iterates over nodes,
+ /// and de-referencing it returns one of the tree's iterators.
typedef
bin_search_tree_const_node_it_<
Node,
};
/// Specialization.
+ /// @ingroup traits
template<typename Key,
class Cmp_Fn,
template<typename Node_CItr,
class Node_Itr,
class Cmp_Fn,
typename _Alloc>
- class Node_Update,
+ class Node_Update,
class Node,
typename _Alloc>
struct bin_search_tree_traits<
typedef const_reverse_iterator reverse_iterator;
+ /// This is an iterator to an iterator: it iterates over nodes,
+ /// and de-referencing it returns one of the tree's iterators.
typedef
bin_search_tree_const_node_it_<
Node,
__gnu_pbds::detail::resize_policy<typename _Alloc::size_type>
/**
- * @brief Binary heaps composed of resize and compare policies.
+ * Binary heaps composed of resize and compare policies.
+ *
+ * @ingroup heap-detail
*
* Based on CLRS.
*/
typedef typename base_type::entry_pointer entry_pointer;
public:
- // Category.
+ /// Category.
typedef std::forward_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef typename _Alloc::difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef typename base_type::value_type value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef typename base_type::pointer pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef typename base_type::const_pointer const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef typename base_type::reference reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef typename base_type::const_reference const_reference;
inline
binary_heap_const_iterator_(entry_pointer p_e) : base_type(p_e)
{ }
- // Default constructor.
+ /// Default constructor.
inline
binary_heap_const_iterator_()
{ }
- // Copy constructor.
+ /// Copy constructor.
inline
binary_heap_const_iterator_(const binary_heap_const_iterator_& other)
: base_type(other)
{ }
- // Compares content to a different iterator object.
+ /// Compares content to a different iterator object.
inline bool
operator==(const binary_heap_const_iterator_& other) const
{ return base_type::m_p_e == other.m_p_e; }
- // Compares content (negatively) to a different iterator object.
+ /// Compares content (negatively) to a different iterator object.
inline bool
operator!=(const binary_heap_const_iterator_& other) const
{ return base_type::m_p_e != other.m_p_e; }
{
namespace detail
{
- // Const point-type iterator.
+ /// Const point-type iterator.
template<typename Value_Type, typename Entry, bool Simple,
typename _Alloc>
class binary_heap_point_const_iterator_
typedef typename _Alloc::template rebind<Entry>::other::pointer entry_pointer;
public:
- // Category.
+ /// Category.
typedef trivial_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef trivial_iterator_difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef Value_Type value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef typename _Alloc::template rebind<value_type>::other::pointer
pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef
typename _Alloc::template rebind<value_type>::other::const_pointer
const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef
typename _Alloc::template rebind<value_type>::other::reference
reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef
typename _Alloc::template rebind<value_type>::other::const_reference
const_reference;
binary_heap_point_const_iterator_(entry_pointer p_e) : m_p_e(p_e)
{ }
- // Default constructor.
+ /// Default constructor.
inline
binary_heap_point_const_iterator_() : m_p_e(0) { }
- // Copy constructor.
+ /// Copy constructor.
inline
binary_heap_point_const_iterator_(const binary_heap_point_const_iterator_& other)
: m_p_e(other.m_p_e)
{ }
- // Access.
+ /// Access.
inline const_pointer
operator->() const
{
return to_ptr(integral_constant<int, Simple>());
}
- // Access.
+ /// Access.
inline const_reference
operator*() const
{
return *to_ptr(integral_constant<int, Simple>());
}
- // Compares content to a different iterator object.
+ /// Compares content to a different iterator object.
inline bool
operator==(const binary_heap_point_const_iterator_& other) const
{ return m_p_e == other.m_p_e; }
- // Compares content (negatively) to a different iterator object.
+ /// Compares content (negatively) to a different iterator object.
inline bool
operator!=(const binary_heap_point_const_iterator_& other) const
{ return m_p_e != other.m_p_e; }
factor = 2
};
- // Next shrink size.
+ /// Next shrink size.
_Tp m_shrink_size;
- // Next grow size.
+ /// Next grow size.
_Tp m_grow_size;
public:
#define PB_DS_CLASS_C_DEC \
binomial_heap<Value_Type, Cmp_Fn, _Alloc>
- /// Binomial heap.
+ /**
+ * Binomial heap.
+ *
+ * @ingroup heap-detail
+ */
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class binomial_heap
: public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
namespace __gnu_pbds
{
- /// A null node updator, indicating that no node updates are required.
- template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
- struct null_node_update : public null_type
- { };
-
namespace detail
{
/// Primary template, base class for branch structure policies.
typename _Alloc::template rebind<Key>::other::const_reference>
#endif
- /// Collision chaining hash.
+
+ /**
+ * A collision-chaining hash-based container.
+ *
+ *
+ * @ingroup hash-detail
+ *
+ * @tparam Key Key type.
+ *
+ * @tparam Mapped Map type.
+ *
+ * @tparam Hash_Fn Hashing functor.
+ * Default is __gnu_cxx::hash.
+ *
+ * @tparam Eq_Fn Equal functor.
+ * Default std::equal_to<Key>
+ *
+ * @tparam _Alloc Allocator type.
+ *
+ * @tparam Store_Hash If key type stores extra metadata.
+ * Defaults to false.
+ *
+ * @tparam Comb_Hash_Fn Combining hash functor.
+ * If Hash_Fn is not null_type, then this
+ * is the ranged-hash functor; otherwise,
+ * this is the range-hashing functor.
+ * XXX(See Design::Hash-Based Containers::Hash Policies.)
+ * Default direct_mask_range_hashing.
+ *
+ * @tparam Resize_Policy Resizes hash.
+ * Defaults to hash_standard_resize_policy,
+ * using hash_exponential_size_policy and
+ * hash_load_check_resize_trigger.
+ *
+ *
+ * Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_hash_fn,
+ * detail::types_traits. (Optional: detail::debug_map_base.)
+ */
template<typename Key,
typename Mapped,
typename Hash_Fn,
typedef Comb_Hash_Fn comb_hash_fn;
typedef Resize_Policy resize_policy;
+ /// Value stores hash, true or false.
enum
{
store_hash = Store_Hash
inline size_type
max_size() const;
+ /// True if size() == 0.
inline bool
empty() const;
+ /// Return current hash_fn.
Hash_Fn&
get_hash_fn();
+ /// Return current const hash_fn.
const Hash_Fn&
get_hash_fn() const;
+ /// Return current eq_fn.
Eq_Fn&
get_eq_fn();
+ /// Return current const eq_fn.
const Eq_Fn&
get_eq_fn() const;
+ /// Return current comb_hash_fn.
Comb_Hash_Fn&
get_comb_hash_fn();
+ /// Return current const comb_hash_fn.
const Comb_Hash_Fn&
get_comb_hash_fn() const;
+ /// Return current resize_policy.
Resize_Policy&
get_resize_policy();
+ /// Return current const resize_policy.
const Resize_Policy&
get_resize_policy() const;
+++ /dev/null
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// 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 detail/constructors_destructor_fn_imps.hpp
- * Contains constructors_destructor_fn_imps applicable to different containers.
- */
-
-inline
-PB_DS_CLASS_NAME()
-{ }
-
-inline
-PB_DS_CLASS_NAME(const PB_DS_CLASS_NAME& other)
-: base_type((const base_type&)other)
-{ }
-
-template<typename T0>
-inline
-PB_DS_CLASS_NAME(T0 t0) : base_type(t0)
-{ }
-
-template<typename T0, typename T1>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1) : base_type(t0, t1)
-{ }
-
-template<typename T0, typename T1, typename T2>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2)
-{ }
-
-template<typename T0, typename T1, typename T2, typename T3>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3)
-: base_type(t0, t1, t2, t3)
-{ }
-
-template<typename T0, typename T1, typename T2, typename T3, typename T4>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)
-: base_type(t0, t1, t2, t3, t4)
-{ }
-
-template<typename T0, typename T1, typename T2, typename T3, typename T4,
- typename T5>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
-: base_type(t0, t1, t2, t3, t4, t5)
-{ }
-
-template<typename T0, typename T1, typename T2, typename T3, typename T4,
- typename T5, typename T6>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
-: base_type(t0, t1, t2, t3, t4, t5, t6)
-{ }
-
-template<typename T0, typename T1, typename T2, typename T3, typename T4,
- typename T5, typename T6, typename T7>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
-: base_type(t0, t1, t2, t3, t4, t5, t6, t7)
-{ }
-
-template<typename T0, typename T1, typename T2, typename T3, typename T4,
- typename T5, typename T6, typename T7, typename T8>
-inline
-PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
-: base_type(t0, t1, t2, t3, t4, t5, t6, t7, t8)
-{ }
{
namespace detail
{
+ /// Primary template.
template<typename Key, typename Eq_Fn, typename _Alloc, bool Store_Hash>
struct hash_eq_fn;
#endif
- /// General probing hash.
+ /**
+ * A general-probing hash-based container.
+ *
+ *
+ * @ingroup hash-detail
+ *
+ * @tparam Key Key type.
+ *
+ * @tparam Mapped Map type.
+ *
+ * @tparam Hash_Fn Hashing functor.
+ * Default is __gnu_cxx::hash.
+ *
+ * @tparam Eq_Fn Equal functor.
+ * Default std::equal_to<Key>
+ *
+ * @tparam _Alloc Allocator type.
+ *
+ * @tparam Store_Hash If key type stores extra metadata.
+ * Defaults to false.
+ *
+ * @tparam Comb_Probe_Fn Combining probe functor.
+ * If Hash_Fn is not null_type, then this
+ * is the ranged-probe functor; otherwise,
+ * this is the range-hashing functor.
+ * XXX See Design::Hash-Based Containers::Hash Policies.
+ * Default direct_mask_range_hashing.
+ *
+ * @tparam Probe_Fn Probe functor.
+ * Defaults to linear_probe_fn,
+ * also quadratic_probe_fn.
+ *
+ * @tparam Resize_Policy Resizes hash.
+ * Defaults to hash_standard_resize_policy,
+ * using hash_exponential_size_policy and
+ * hash_load_check_resize_trigger.
+ *
+ *
+ * Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_probe_fn,
+ * detail::types_traits. (Optional: detail::debug_map_base.)
+ */
template<typename Key,
typename Mapped,
typename Hash_Fn,
typedef Comb_Probe_Fn comb_probe_fn;
typedef Resize_Policy resize_policy;
+ /// Value stores hash, true or false.
enum
{
store_hash = Store_Hash
PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
- const Probe_Fn&);
+ const Probe_Fn&);
PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
- const Probe_Fn&, const Resize_Policy&);
+ const Probe_Fn&, const Resize_Policy&);
template<typename It>
void
inline size_type
max_size() const;
+ /// True if size() == 0.
inline bool
empty() const;
+ /// Return current hash_fn.
Hash_Fn&
get_hash_fn();
+ /// Return current const hash_fn.
const Hash_Fn&
get_hash_fn() const;
+ /// Return current eq_fn.
Eq_Fn&
get_eq_fn();
+ /// Return current const eq_fn.
const Eq_Fn&
get_eq_fn() const;
+ /// Return current probe_fn.
Probe_Fn&
get_probe_fn();
+ /// Return current const probe_fn.
const Probe_Fn&
get_probe_fn() const;
+ /// Return current comb_probe_fn.
Comb_Probe_Fn&
get_comb_probe_fn();
+ /// Return current const comb_probe_fn.
const Comb_Probe_Fn&
get_comb_probe_fn() const;
+ /// Return current resize_policy.
Resize_Policy&
get_resize_policy();
+ /// Return current const resize_policy.
const Resize_Policy&
get_resize_policy() const;
erase(key_const_reference);
template<typename Pred>
- inline size_type
- erase_if(Pred);
+ inline size_type
+ erase_if(Pred);
void
clear();
inline iterator
end();
-
+
inline const_iterator
end() const;
insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)
{
_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=
- valid_entry_status);
+ valid_entry_status);
if (do_resize_if_needed())
r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val),
{
namespace detail
{
-#define PB_DS_CLASS_T_DEC template<typename Size_Type>
-#define PB_DS_CLASS_C_DEC mask_based_range_hashing<Size_Type>
-
+ /// Range hashing policy.
template<typename Size_Type>
class mask_based_range_hashing
{
protected:
- typedef Size_Type size_type;
+ typedef Size_Type size_type;
void
swap(mask_based_range_hashing& other)
const static size_type s_highest_bit_1;
};
- PB_DS_CLASS_T_DEC
- const typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::s_num_bits_in_size_type =
- sizeof(typename PB_DS_CLASS_C_DEC::size_type) << 3;
+ template<typename Size_Type>
+ const typename mask_based_range_hashing<Size_Type>::size_type
+ mask_based_range_hashing<Size_Type>::s_num_bits_in_size_type =
+ sizeof(typename mask_based_range_hashing<Size_Type>::size_type) << 3;
- PB_DS_CLASS_T_DEC
- const typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC::s_highest_bit_1 = static_cast<typename PB_DS_CLASS_C_DEC::size_type>(1) << (s_num_bits_in_size_type - 1);
+ template<typename Size_Type>
+ const typename mask_based_range_hashing<Size_Type>::size_type mask_based_range_hashing<Size_Type>::s_highest_bit_1 = static_cast<typename mask_based_range_hashing<Size_Type>::size_type>(1) << (s_num_bits_in_size_type - 1);
- PB_DS_CLASS_T_DEC
+ template<typename Size_Type>
void
- PB_DS_CLASS_C_DEC::
+ mask_based_range_hashing<Size_Type>::
notify_resized(size_type size)
{
size_type i = 0;
while (i++ < s_num_bits_in_size_type)
m_mask = (m_mask << 1) ^ 1;
}
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
} // namespace detail
} // namespace __gnu_pbds
namespace __gnu_pbds
{
-
namespace detail
{
-
-#define PB_DS_CLASS_T_DEC \
- template<typename Size_Type>
-
-#define PB_DS_CLASS_C_DEC \
- mod_based_range_hashing< \
- Size_Type>
-
+ /// Mod based range hashing.
template<typename Size_Type>
class mod_based_range_hashing
{
protected:
- typedef Size_Type size_type;
+ typedef Size_Type size_type;
- protected:
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(mod_based_range_hashing& other)
+ { std::swap(m_size, other.m_size); }
void
- notify_resized(size_type size);
+ notify_resized(size_type s)
+ { m_size = s; }
inline size_type
- range_hash(size_type hash) const;
+ range_hash(size_type s) const
+ { return s % m_size; }
private:
size_type m_size;
};
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- swap(PB_DS_CLASS_C_DEC& other)
- {
- std::swap(m_size, other.m_size);
- }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- notify_resized(size_type size)
- {
- m_size = size;
- }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
- range_hash(size_type hash) const
- {
- return (hash % m_size);
- }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
} // namespace detail
} // namespace __gnu_pbds
{
namespace detail
{
+ /// Probe functor base.
template<typename _Alloc>
class probe_fn_base
{
{
namespace detail
{
+ /// Primary template.
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Hash_Fn, bool Store_Hash>
class ranged_hash_fn;
{
namespace detail
{
+ /// Primary template.
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>
class ranged_probe_fn;
public:
typedef std::size_t size_type;
- // Default constructor.
+ /// Default constructor.
sample_probe_fn();
- // Copy constructor.
+ /// Copy constructor.
sample_probe_fn(const sample_probe_fn&);
- // Swaps content.
+ /// Swaps content.
inline void
swap(sample_probe_fn&);
protected:
- // Returns the i-th offset from the hash value of some key r_key.
+ /// Returns the i-th offset from the hash value of some key r_key.
inline size_type
operator()(key_const_reference r_key, size_type i) const;
};
class sample_range_hashing
{
public:
- // Size type.
+ /// Size type.
typedef std::size_t size_type;
- // Default constructor.
+ /// Default constructor.
sample_range_hashing();
- // Copy constructor.
+ /// Copy constructor.
sample_range_hashing(const sample_range_hashing& other);
- // Swaps content.
+ /// Swaps content.
inline void
swap(sample_range_hashing& other);
protected:
- // Notifies the policy object that the container's __size has
- // changed to size.
+ /// Notifies the policy object that the container's size has
+ /// changed to argument's size.
void
notify_resized(size_type);
- // Transforms the __hash value hash into a ranged-hash value.
+ /// Transforms the __hash value hash into a ranged-hash value.
inline size_type
operator()(size_type ) const;
};
public:
typedef std::size_t size_type;
- // Default constructor.
+ /// Default constructor.
sample_ranged_hash_fn();
- // Copy constructor.
+ /// Copy constructor.
sample_ranged_hash_fn(const sample_ranged_hash_fn&);
- // Swaps content.
+ /// Swaps content.
inline void
swap(sample_ranged_hash_fn&);
protected:
- // Notifies the policy object that the container's __size has
- // changed to size.
+ /// Notifies the policy object that the container's __size has
+ /// changed to size.
void
notify_resized(size_type);
- // Transforms key_const_reference into a position within the table.
+ /// Transforms key_const_reference into a position within the table.
inline size_type
operator()(key_const_reference) const;
typedef typename base_type::node_pointer node_pointer;
public:
- // Category.
+ /// Category.
typedef std::forward_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef typename _Alloc::difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef typename base_type::value_type value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef typename base_type::pointer pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef typename base_type::const_pointer const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef typename base_type::reference reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef typename base_type::const_reference const_reference;
inline
: base_type(p_nd)
{ }
- // Default constructor.
+ /// Default constructor.
inline
left_child_next_sibling_heap_const_iterator_()
{ }
- // Copy constructor.
+ /// Copy constructor.
inline
left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)
{ }
- // Compares content to a different iterator object.
- inline bool
+ /// Compares content to a different iterator object.
+ bool
operator==(const PB_DS_CLASS_C_DEC& other) const
{ return (base_type::m_p_nd == other.m_p_nd); }
- // Compares content (negatively) to a different iterator object.
- inline bool
+ /// Compares content (negatively) to a different iterator object.
+ bool
operator!=(const PB_DS_CLASS_C_DEC& other) const
{ return (base_type::m_p_nd != other.m_p_nd); }
- inline PB_DS_CLASS_C_DEC&
+ PB_DS_CLASS_C_DEC&
operator++()
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != 0);
return (*this);
}
- inline PB_DS_CLASS_C_DEC
+ PB_DS_CLASS_C_DEC
operator++(int)
{
PB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd);
protected:
typedef
typename _Alloc::template rebind<
- left_child_next_sibling_heap_node_<Value_Type, Node_Metadata,
+ left_child_next_sibling_heap_node_<Value_Type, Node_Metadata,
_Alloc> >::other
node_allocator;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
- public:
-
left_child_next_sibling_heap();
left_child_next_sibling_heap(const Cmp_Fn&);
left_child_next_sibling_heap(const left_child_next_sibling_heap&);
#endif
protected:
-
inline node_pointer
get_new_node_for_insert(const_reference);
trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);
static void
- trace_node_metadata(node_const_pointer,
- type_to_type<null_type>);
+ trace_node_metadata(node_const_pointer, type_to_type<null_type>);
#endif
- protected:
- node_pointer m_p_root;
- size_type m_size;
- private:
static node_allocator s_node_allocator;
static no_throw_copies_t s_no_throw_copies_ind;
+
+ protected:
+ node_pointer m_p_root;
+ size_type m_size;
};
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>
template<typename Node, typename _Alloc>
class left_child_next_sibling_heap_node_point_const_iterator_
{
-
protected:
typedef typename _Alloc::template rebind<Node>::other::pointer node_pointer;
public:
-
- // Category.
+ /// Category.
typedef trivial_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef trivial_iterator_difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef typename Node::value_type value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef
typename _Alloc::template rebind<
value_type>::other::pointer
pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef
typename _Alloc::template rebind<
value_type>::other::const_pointer
const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef
typename _Alloc::template rebind<
value_type>::other::reference
reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef
typename _Alloc::template rebind<
value_type>::other::const_reference
const_reference;
- public:
-
inline
left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
{ }
- // Default constructor.
+ /// Default constructor.
inline
left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0)
{ }
- // Copy constructor.
+ /// Copy constructor.
inline
left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
{ }
- // Access.
- inline const_pointer
+ /// Access.
+ const_pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return &m_p_nd->m_value;
}
- // Access.
- inline const_reference
+ /// Access.
+ const_reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return m_p_nd->m_value;
}
- // Compares content to a different iterator object.
- inline bool
+ /// Compares content to a different iterator object.
+ bool
operator==(const PB_DS_CLASS_C_DEC& other) const
{ return m_p_nd == other.m_p_nd; }
- // Compares content (negatively) to a different iterator object.
- inline bool
+ /// Compares content (negatively) to a different iterator object.
+ bool
operator!=(const PB_DS_CLASS_C_DEC& other) const
{ return m_p_nd != other.m_p_nd; }
- public:
node_pointer m_p_nd;
};
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
/// A sample list-update policy.
struct sample_update_policy
{
- // Default constructor.
+ /// Default constructor.
sample_update_policy();
- // Copy constructor.
+ /// Copy constructor.
sample_update_policy(const sample_update_policy&);
- // Swaps content.
+ /// Swaps content.
inline void
swap(sample_update_policy& other);
protected:
- // Metadata on which this functor operates.
+ /// Metadata on which this functor operates.
typedef some_metadata_type metadata_type;
- // Creates a metadata object.
+ /// Creates a metadata object.
metadata_type
operator()() const;
- // Decides whether a metadata object should be moved to the front of
- // the list. A list-update based containers object will call this
- // method to decide whether to move a node to the front of the
- // list. The method shoule return true if the node should be moved
- // to the front of the list.
+ /// Decides whether a metadata object should be moved to the front
+ /// of the list. A list-update based containers object will call
+ /// this method to decide whether to move a node to the front of
+ /// the list. The method shoule return true if the node should be
+ /// moved to the front of the list.
bool
operator()(metadata_reference) const;
};
return *m_p_metadata;
}
+ /// Returns the node iterator associated with the left node.
inline this_type
get_l_child() const
{
mid_pointer(p_begin_metadata, m_p_metadata)));
}
+ /// Returns the node iterator associated with the right node.
inline this_type
get_r_child() const
{
if (m_p_value == m_p_end_value)
- return (this_type(m_p_end_value, m_p_end_value, m_p_end_value));
+ return (this_type(m_p_end_value, m_p_end_value, m_p_end_value));
const_metadata_pointer p_end_metadata =
m_p_metadata + (m_p_end_value - m_p_value);
template<typename Value_Type, typename Metadata_Type, typename _Alloc>
class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC
{
-
private:
typedef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC this_type;
const_metadata_pointer;
public:
-
typedef trivial_iterator_tag iterator_category;
typedef trivial_iterator_difference_type difference_type;
Value_Type>::type>::other::pointer
const_reference;
- public:
inline
ov_tree_node_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata)
{ }
- // Access.
+ /// Access.
inline reference
operator*() const
{ return reference(base_type::m_p_value); }
- // Returns the node reference associated with the left node.
+ /// Returns the node reference associated with the left node.
inline ov_tree_node_it_
get_l_child() const
{
base_type::mid_pointer(p_begin_metadata, base_type::m_p_metadata)));
}
- // Returns the node reference associated with the right node.
+ /// Returns the node reference associated with the right node.
inline ov_tree_node_it_
get_r_child() const
{
if (base_type::m_p_value == base_type::m_p_end_value)
- return this_type(base_type::m_p_end_value,
- base_type::m_p_end_value,
+ return this_type(base_type::m_p_end_value, base_type::m_p_end_value,
base_type::m_p_end_value);
const_metadata_pointer p_end_metadata =
/**
* @file ov_tree_map_/ov_tree_map_.hpp
- * Contains an implementation class for ov_tree_.
+ * Contains an implementation class for ov_tree.
*/
#include <map>
# error Missing definition
#endif
- /// Ordered-vector tree associative-container.
+ /**
+ * @brief Ordered-vector tree associative-container.
+ * @ingroup branch-detail
+ */
template<typename Key, typename Mapped, typename Cmp_Fn,
typename Node_And_It_Traits, typename _Alloc>
class PB_DS_OV_TREE_NAME :
end() const
{ return m_end_it; }
+ /// Returns a const node_iterator corresponding to the node at the
+ /// root of the tree.
inline node_const_iterator
node_begin() const;
- inline node_const_iterator
- node_end() const;
-
+ /// Returns a node_iterator corresponding to the node at the
+ /// root of the tree.
inline node_iterator
node_begin();
+ /// Returns a const node_iterator corresponding to a node just
+ /// after a leaf of the tree.
+ inline node_const_iterator
+ node_end() const;
+
+ /// Returns a node_iterator corresponding to a node just
+ /// after a leaf of the tree.
inline node_iterator
node_end();
namespace detail
{
/// Tree traits.
+ /// @ingroup traits
template<typename Key,
typename Mapped,
class Cmp_Fn,
_Alloc>::type
metadata_type;
+ /// This is an iterator to an iterator: it iterates over nodes,
+ /// and de-referencing it returns one of the tree's iterators.
typedef
ov_tree_node_const_it_<
value_type,
null_node_update_pointer;
};
+
/// Specialization.
+ /// @ingroup traits
template<typename Key,
class Cmp_Fn,
template<typename Node_CItr,
_Alloc>::type
metadata_type;
+ /// This is an iterator to an iterator: it iterates over nodes,
+ /// and de-referencing it returns one of the tree's iterators.
typedef
ov_tree_node_const_it_<
value_type,
left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc>
#endif
- /// Pairing heap.
+ /**
+ * Pairing heap.
+ *
+ * @ingroup heap-detail
+ */
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class pairing_heap : public PB_DS_P_HEAP_BASE
{
/**
* @brief PATRICIA trie.
+ * @ingroup branch-detail
*
- * This implementation loosely borrows ideas from:
- * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998
- * 2) Ptset: Sets of integers implemented as Patricia trees,
- * Jean-Christophe Filliatr, 2000
+ * This implementation loosely borrows ideas from:
+ * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998
+ * 2) Ptset: Sets of integers implemented as Patricia trees,
+ * Jean-Christophe Filliatr, 2000
*/
template<typename Key, typename Mapped, typename Node_And_It_Traits,
typename _Alloc>
inline const_reverse_iterator
rend() const;
+ /// Returns a const node_iterator corresponding to the node at the
+ /// root of the tree.
inline node_const_iterator
node_begin() const;
+ /// Returns a node_iterator corresponding to the node at the
+ /// root of the tree.
inline node_iterator
node_begin();
+ /// Returns a const node_iterator corresponding to a node just
+ /// after a leaf of the tree.
inline node_const_iterator
node_end() const;
+ /// Returns a node_iterator corresponding to a node just
+ /// after a leaf of the tree.
inline node_iterator
node_end();
typedef value_type reference;
typedef value_type const_reference;
- // Metadata type.
+ /// Metadata type.
typedef typename Node::metadata_type metadata_type;
- // Const metadata reference type.
+ /// Const metadata reference type.
typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
typedef typename __rebind_m::other __rebind_ma;
typedef typename __rebind_ma::const_reference metadata_const_reference;
: m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
{ }
- // Subtree valid prefix.
+ /// Subtree valid prefix.
std::pair<a_const_iterator, a_const_iterator>
valid_prefix() const
{ return std::make_pair(pref_begin(), pref_end()); }
- // Const access; returns the __const iterator* associated with
- // the current leaf.
+ /// Const access; returns the __const iterator* associated with
+ /// the current leaf.
const_reference
operator*() const
{
return _CIterator(m_p_nd);
}
- // Metadata access.
+ /// Metadata access.
metadata_const_reference
get_metadata() const
{ return m_p_nd->get_metadata(); }
- // Returns the number of children in the corresponding node.
+ /// Returns the number of children in the corresponding node.
size_type
num_children() const
{
return std::distance(inp->begin(), inp->end());
}
- // Returns a __const node __iterator to the corresponding node's
- // i-th child.
+ /// Returns a __const node __iterator to the corresponding node's
+ /// i-th child.
_Node_citer
get_child(size_type i) const
{
return _Node_citer(*it, m_p_traits);
}
- // Compares content to a different iterator object.
+ /// Compares content to a different iterator object.
bool
operator==(const _Node_citer& other) const
{ return m_p_nd == other.m_p_nd; }
- // Compares content (negatively) to a different iterator object.
+ /// Compares content (negatively) to a different iterator object.
bool
operator!=(const _Node_citer& other) const
{ return m_p_nd != other.m_p_nd; }
: base_type(p_nd, p_traits)
{ }
- // Access; returns the iterator* associated with the current leaf.
+ /// Access; returns the iterator* associated with the current leaf.
reference
operator*() const
{
return iterator(base_type::m_p_nd);
}
- // Returns a node __iterator to the corresponding node's i-th child.
+ /// Returns a node __iterator to the corresponding node's i-th child.
_Node_iter
get_child(size_type i) const
{
namespace detail
{
/// Specialization.
+ /// @ingroup traits
template<typename Key,
typename Mapped,
typename _ATraits,
typedef base_type::_Metadata<metadata_type, _Alloc> metadata;
typedef _ATraits access_traits;
+ /// Type for synthesized traits.
typedef __gnu_pbds::detail::synth_access_traits<type_traits, false, access_traits> synth_access_traits;
typedef base_type::_Node_base<synth_access_traits, metadata> node;
typedef base_type::_Iter<node, leaf, head, inode, false> reverse_iterator;
typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator;
-
+ /// This is an iterator to an iterator: it iterates over nodes,
+ /// and de-referencing it returns one of the tree's iterators.
typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
typedef base_type::_Node_iter<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_iterator;
+ /// Type for node update.
typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update;
typedef null_node_update<node_const_iterator, node_iterator, _ATraits, _Alloc>* null_node_update_pointer;
};
+
/// Specialization.
+ /// @ingroup traits
template<typename Key,
typename _ATraits,
template<typename Node_CItr,
typedef typename trie_node_metadata_dispatch<Key, null_type, _ATraits, Node_Update, _Alloc>::type metadata_type;
typedef base_type::_Metadata<metadata_type, _Alloc> metadata;
typedef _ATraits access_traits;
+
+ /// Type for synthesized traits.
typedef __gnu_pbds::detail::synth_access_traits<type_traits, true, access_traits> synth_access_traits;
typedef base_type::_Node_base<synth_access_traits, metadata> node;
typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator;
typedef const_reverse_iterator reverse_iterator;
-
+ /// This is an iterator to an iterator: it iterates over nodes,
+ /// and de-referencing it returns one of the tree's iterators.
typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
typedef node_const_iterator node_iterator;
+ /// Type for node update.
typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update;
typedef null_node_update<node_const_iterator, node_const_iterator, _ATraits, _Alloc>* null_node_update_pointer;
/// Dispatched type.
typedef thin_heap<_VTp, Cmp_Fn, _Alloc> type;
};
- // @} group pbds
+ //@} group pbds
} // namespace detail
} // namespace __gnu_pbds
PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
- /*
+ /**
* @brief Red-Black tree.
+ * @ingroup branch-detail
*
* This implementation uses an idea from the SGI STL (using a
* @a header node which is needed for efficient iteration).
namespace detail
{
/// Specialization.
+ /// @ingroup traits
template<typename Key,
typename Mapped,
typename Cmp_Fn,
typename _Alloc_>
class Node_Update,
typename _Alloc>
- struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, rb_tree_tag, _Alloc>
+ struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc>
: public bin_search_tree_traits<
Key,
Mapped,
{ };
/// Specialization.
+ /// @ingroup traits
template<typename Key,
typename Cmp_Fn,
template<typename Node_CItr,
typename _Alloc_>
class Node_Update,
typename _Alloc>
- struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, rb_tree_tag, _Alloc>
+ struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc>
: public bin_search_tree_traits<
Key,
null_type,
#define PB_DS_RC_C_DEC \
rc<typename binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>::node, _Alloc>
- /// Base class for redundant-counter binomial heap.
+ /**
+ * Redundant-counter binomial heap.
+ *
+ * @ingroup heap-detail
+ */
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class rc_binomial_heap
: public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
{
namespace detail
{
- // Primary template.
+ /// Primary template.
template<typename Size_Type, bool Hold_Size>
class hash_load_check_resize_trigger_size_base;
- // Specializations.
+ /// Specializations.
template<typename Size_Type>
class hash_load_check_resize_trigger_size_base<Size_Type, true>
{
class sample_resize_policy
{
public:
- // Size type.
+ /// Size type.
typedef std::size_t size_type;
- // Default constructor.
+ /// Default constructor.
sample_resize_policy();
- // Copy constructor.
+ /// Copy constructor.
sample_range_hashing(const sample_resize_policy& other);
- // Swaps content.
+ /// Swaps content.
inline void
swap(sample_resize_policy& other);
protected:
- // Notifies a search started.
+ /// Notifies a search started.
inline void
notify_insert_search_start();
- // Notifies a search encountered a collision.
+ /// Notifies a search encountered a collision.
inline void
notify_insert_search_collision();
- // Notifies a search ended.
+ /// Notifies a search ended.
inline void
notify_insert_search_end();
- // Notifies a search started.
+ /// Notifies a search started.
inline void
notify_find_search_start();
- // Notifies a search encountered a collision.
+ /// Notifies a search encountered a collision.
inline void
notify_find_search_collision();
- // Notifies a search ended.
+ /// Notifies a search ended.
inline void
notify_find_search_end();
- // Notifies a search started.
+ /// Notifies a search started.
inline void
notify_erase_search_start();
- // Notifies a search encountered a collision.
+ /// Notifies a search encountered a collision.
inline void
notify_erase_search_collision();
- // Notifies a search ended.
+ /// Notifies a search ended.
inline void
notify_erase_search_end();
- // Notifies an element was inserted.
+ /// Notifies an element was inserted.
inline void
notify_inserted(size_type num_e);
- // Notifies an element was erased.
+ /// Notifies an element was erased.
inline void
notify_erased(size_type num_e);
- // Notifies the table was cleared.
+ /// Notifies the table was cleared.
void
notify_cleared();
- // Notifies the table was resized to new_size.
+ /// Notifies the table was resized to new_size.
void
notify_resized(size_type new_size);
- // Queries whether a resize is needed.
+ /// Queries whether a resize is needed.
inline bool
is_resize_needed() const;
- // Queries what the new size should be.
+ /// Queries what the new size should be.
size_type
get_new_size(size_type size, size_type num_used_e) const;
};
class sample_resize_trigger
{
public:
- // Size type.
+ /// Size type.
typedef std::size_t size_type;
- // Default constructor.
+ /// Default constructor.
sample_resize_trigger();
- // Copy constructor.
+ /// Copy constructor.
sample_range_hashing(const sample_resize_trigger&);
- // Swaps content.
+ /// Swaps content.
inline void
swap(sample_resize_trigger&);
protected:
- // Notifies a search started.
+ /// Notifies a search started.
inline void
notify_insert_search_start();
- // Notifies a search encountered a collision.
+ /// Notifies a search encountered a collision.
inline void
notify_insert_search_collision();
- // Notifies a search ended.
+ /// Notifies a search ended.
inline void
notify_insert_search_end();
- // Notifies a search started.
+ /// Notifies a search started.
inline void
notify_find_search_start();
- // Notifies a search encountered a collision.
+ /// Notifies a search encountered a collision.
inline void
notify_find_search_collision();
- // Notifies a search ended.
+ /// Notifies a search ended.
inline void
notify_find_search_end();
- // Notifies a search started.
+ /// Notifies a search started.
inline void
notify_erase_search_start();
- // Notifies a search encountered a collision.
+ /// Notifies a search encountered a collision.
inline void
notify_erase_search_collision();
- // Notifies a search ended.
+ /// Notifies a search ended.
inline void
notify_erase_search_end();
- // Notifies an element was inserted. the total number of entries in
- // the table is num_entries.
+ /// Notifies an element was inserted. the total number of entries in
+ /// the table is num_entries.
inline void
notify_inserted(size_type num_entries);
- // Notifies an element was erased.
+ /// Notifies an element was erased.
inline void
notify_erased(size_type num_entries);
- // Notifies the table was cleared.
+ /// Notifies the table was cleared.
void
notify_cleared();
- // Notifies the table was resized as a result of this object's
- // signifying that a resize is needed.
+ /// Notifies the table was resized as a result of this object's
+ /// signifying that a resize is needed.
void
notify_resized(size_type new_size);
- // Notifies the table was resized externally.
+ /// Notifies the table was resized externally.
void
notify_externally_resized(size_type new_size);
- // Queries whether a resize is needed.
+ /// Queries whether a resize is needed.
inline bool
is_resize_needed() const;
- // Queries whether a grow is needed.
+ /// Queries whether a grow is needed.
inline bool
is_grow_needed(size_type size, size_type num_entries) const;
private:
- // Resizes to new_size.
+ /// Resizes to new_size.
virtual void
do_resize(size_type);
};
class sample_size_policy
{
public:
- // Size type.
+ /// Size type.
typedef std::size_t size_type;
- // Default constructor.
+ /// Default constructor.
sample_size_policy();
- // Copy constructor.
+ /// Copy constructor.
sample_range_hashing(const sample_size_policy&);
- // Swaps content.
+ /// Swaps content.
inline void
swap(sample_size_policy& other);
protected:
- // Given a __size size, returns a __size that is larger.
+ /// Given a __size size, returns a __size that is larger.
inline size_type
get_nearest_larger_size(size_type size) const;
- // Given a __size size, returns a __size that is smaller.
+ /// Given a __size size, returns a __size that is smaller.
inline size_type
get_nearest_smaller_size(size_type size) const;
};
PB_DS_S_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
- /// Splay Tree.
+ /**
+ * @brief Splay tree.
+ * @ingroup branch-detail
+ */
template<typename Key, typename Mapped, typename Cmp_Fn,
typename Node_And_It_Traits, typename _Alloc>
class PB_DS_S_TREE_NAME : public PB_DS_S_TREE_BASE
namespace detail
{
/// Specialization.
+ /// @ingroup traits
template<typename Key,
typename Mapped,
typename Cmp_Fn,
{ };
/// Specialization.
+ /// @ingroup traits
template<typename Key,
class Cmp_Fn,
template<typename Node_CItr,
{
namespace detail
{
- /// default_hash_fn
+ /// Primary template, default_hash_fn.
template<typename Key>
struct default_hash_fn
{
- typedef std::tr1::hash<Key> type;
+ /// Dispatched type.
+ typedef std::tr1::hash<Key> type;
};
- /// default_eq_fn
+ /// Primary template, default_eq_fn.
template<typename Key>
struct default_eq_fn
{
- typedef std::equal_to<Key> type;
+ /// Dispatched type.
+ typedef std::equal_to<Key> type;
};
+ /// Enumeration for default behavior of stored hash data.
enum
{
default_store_hash = false
};
- /// default_comb_hash_fn
+ /// Primary template, default_comb_hash_fn.
struct default_comb_hash_fn
{
- typedef __gnu_pbds::direct_mask_range_hashing<> type;
+ /// Dispatched type.
+ typedef direct_mask_range_hashing<> type;
};
- /// default_resize_policy
+ /// Primary template, default_resize_policy.
template<typename Comb_Hash_Fn>
struct default_resize_policy
{
private:
- typedef typename Comb_Hash_Fn::size_type size_type;
+ typedef typename Comb_Hash_Fn::size_type size_type;
- typedef __gnu_pbds::direct_mask_range_hashing<size_type> default_fn;
- typedef is_same<default_fn, Comb_Hash_Fn> same_type;
- typedef __gnu_pbds::hash_exponential_size_policy<size_type> iftrue;
- typedef __gnu_pbds::hash_prime_size_policy iffalse;
+ typedef direct_mask_range_hashing<size_type> default_fn;
+ typedef is_same<default_fn, Comb_Hash_Fn> same_type;
+ typedef hash_exponential_size_policy<size_type> iftrue;
+ typedef hash_prime_size_policy iffalse;
typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;
- typedef typename cond_type::__type size_policy_type;
+ typedef typename cond_type::__type size_policy_type;
- typedef __gnu_pbds::hash_load_check_resize_trigger<false, size_type> trigger;
+ typedef hash_load_check_resize_trigger<false, size_type> trigger;
public:
- typedef __gnu_pbds::hash_standard_resize_policy<size_policy_type, trigger, false, size_type> type;
+ /// Dispatched type.
+ typedef hash_standard_resize_policy<size_policy_type, trigger,
+ false, size_type> type;
};
- /// default_update_policy
+ /// Default update policy.
struct default_update_policy
{
- typedef __gnu_pbds::lu_move_to_front_policy<> type;
+ /// Dispatched type.
+ typedef lu_move_to_front_policy<> type;
};
- /// default_probe_fn
+ /// Primary template, default_probe_fn.
template<typename Comb_Probe_Fn>
struct default_probe_fn
{
private:
- typedef typename Comb_Probe_Fn::size_type size_type;
-
- typedef __gnu_pbds::direct_mask_range_hashing<size_type> default_fn;
- typedef is_same<default_fn, Comb_Probe_Fn> same_type;
- typedef __gnu_pbds::linear_probe_fn<size_type> iftrue;
- typedef __gnu_pbds::quadratic_probe_fn<size_type> iffalse;
+ typedef typename Comb_Probe_Fn::size_type size_type;
+ typedef direct_mask_range_hashing<size_type> default_fn;
+ typedef is_same<default_fn, Comb_Probe_Fn> same_type;
+ typedef linear_probe_fn<size_type> iftrue;
+ typedef quadratic_probe_fn<size_type> iffalse;
typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;
public:
- typedef typename cond_type::__type type;
+ /// Dispatched type.
+ typedef typename cond_type::__type type;
};
- /// default_trie_access_traits
+
+ /// Primary template, default_trie_access_traits.
template<typename Key>
- struct default_trie_access_traits;
+ struct default_trie_access_traits;
+
+#define __dtrie_alloc std::allocator<char>
+#define __dtrie_string std::basic_string<Char, Char_Traits, __dtrie_alloc>
+ /// Partial specialization, default_trie_access_traits.
template<typename Char, typename Char_Traits>
- struct default_trie_access_traits<std::basic_string<Char, Char_Traits, std::allocator<char> > >
- {
- private:
- typedef std::basic_string<Char, Char_Traits, std::allocator<char> > string_type;
+ struct default_trie_access_traits<__dtrie_string>
+ {
+ private:
+ typedef __dtrie_string string_type;
- public:
- typedef __gnu_pbds::trie_string_access_traits<string_type> type;
- };
+ public:
+ /// Dispatched type.
+ typedef trie_string_access_traits<string_type> type;
+ };
+
+#undef __dtrie_alloc
+#undef __dtrie_string
} // namespace detail
} // namespace __gnu_pbds
<Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc>
#endif
+
/**
* Thin heap.
- * Base class for @ref priority_queue.
+ *
+ * @ingroup heap-detail
*
* See Tarjan and Kaplan.
*/
{
namespace detail
{
+ /**
+ * @addtogroup traits Traits
+ * @{
+ */
+
/// Tree metadata helper.
template<typename Node_Update, bool _BTp>
struct tree_metadata_helper;
+ /// Specialization, false.
template<typename Node_Update>
struct tree_metadata_helper<Node_Update, false>
{
typedef typename Node_Update::metadata_type type;
};
+ /// Specialization, true.
template<typename Node_Update>
struct tree_metadata_helper<Node_Update, true>
{
public:
typedef typename tree_metadata_helper<__node_u, null_update>::type type;
};
+ //@}
} // namespace detail
} // namespace __gnu_pbds
{
typedef std::size_t metadata_type;
- // Default constructor.
+ /// Default constructor.
sample_tree_node_update();
- // Updates the rank of a node through a node_iterator node_it;
- // end_nd_it is the end node iterator.
+ /// Updates the rank of a node through a node_iterator node_it;
+ /// end_nd_it is the end node iterator.
inline void
operator()(node_iterator node_it, node_const_iterator end_nd_it) const;
};
{
namespace detail
{
+ /**
+ * @addtogroup traits Traits
+ * @{
+ */
+
/// Trie metadata helper.
template<typename Node_Update, bool _BTp>
struct trie_metadata_helper;
+ /// Specialization, false.
template<typename Node_Update>
struct trie_metadata_helper<Node_Update, false>
{
typedef typename Node_Update::metadata_type type;
};
+ /// Specialization, true.
template<typename Node_Update>
struct trie_metadata_helper<Node_Update, true>
{
public:
typedef typename trie_metadata_helper<__node_u, null_update>::type type;
};
+ //@}
} // namespace detail
} // namespace __gnu_pbds
typedef typename __rebind_k::other::const_reference key_const_reference;
typedef std::string::const_iterator const_iterator;
- // Element type.
+ /// Element type.
typedef char e_type;
enum
max_size = 4
};
- // Returns a const_iterator to the first element of r_key.
+ /// Returns a const_iterator to the first element of r_key.
inline static const_iterator
begin(key_const_reference);
- // Returns a const_iterator to the after-last element of r_key.
+ /// Returns a const_iterator to the after-last element of r_key.
inline static const_iterator
end(key_const_reference);
- // Maps an element to a position.
+ /// Maps an element to a position.
inline static size_type
e_pos(e_type);
};
typedef std::size_t metadata_type;
protected:
- // Default constructor.
+ /// Default constructor.
sample_trie_node_update();
- // Updates the rank of a node through a node_iterator node_it;
- // end_nd_it is the end node iterator.
+ /// Updates the rank of a node through a node_iterator node_it;
+ /// end_nd_it is the end node iterator.
inline void
operator()(node_iterator, node_const_iterator) const;
};
{
namespace detail
{
+ /**
+ * @addtogroup traits Traits
+ * @{
+ */
+
/// Primary template.
template<typename Key, typename Mapped>
struct no_throw_copies
};
- //@{
- /**
- * Data properties computation.
- */
-
/// Stored value.
template<typename _Tv>
struct stored_value
* table.
*/
-// Const range-type iterator.
-class const_iterator_ :
- public point_const_iterator_
-
+/// Const range-type iterator.
+class const_iterator_
+: public point_const_iterator_
{
-
public:
-
- // Category.
+ /// Category.
typedef std::forward_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef typename _Alloc::difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef value_type_ value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef pointer_ pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef reference_ reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef const_reference_ const_reference;
-public:
-
- // Default constructor.
- inline
- const_iterator_()
-
- : m_p_tbl(0)
+ /// Default constructor.
+ const_iterator_() : m_p_tbl(0)
{ }
- // Increments.
- inline const_iterator_&
+ /// Increments.
+ const_iterator_&
operator++()
{
m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);
-
- return (*this);
+ return *this;
}
- // Increments.
- inline const_iterator_
+ /// Increments.
+ const_iterator_
operator++(int)
{
const_iterator_ ret =* this;
-
m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);
-
- return (ret);
+ return ret;
}
protected:
-
typedef point_const_iterator_ base_type;
-protected:
-
/**
* Constructor used by the table to initiate the generalized
* pointer and position (e.g., this is called from within a find()
* of a table.
* */
- inline
- const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos, const PB_DS_CLASS_C_DEC* p_tbl) : point_const_iterator_(p_value),
- m_p_tbl(p_tbl),
- m_pos(pos)
+ const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos,
+ const PB_DS_CLASS_C_DEC* p_tbl)
+ : point_const_iterator_(p_value), m_p_tbl(p_tbl), m_pos(pos)
{ }
-protected:
-
/**
* Pointer to the table object which created the iterator (used for
* incrementing its position.
friend class PB_DS_CLASS_C_DEC;
};
-
* table.
*/
-// Range-type iterator.
-class iterator_ :
- public const_iterator_
-
+/// Range-type iterator.
+class iterator_
+: public const_iterator_
{
-
public:
-
- // Category.
+ /// Category.
typedef std::forward_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef typename _Alloc::difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef value_type_ value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef pointer_ pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef reference_ reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef const_reference_ const_reference;
-public:
-
- // Default constructor.
+ /// Default constructor.
inline
iterator_()
+ : const_iterator_(0, PB_DS_GEN_POS(), 0) { }
- : const_iterator_(0, PB_DS_GEN_POS(), 0)
- { }
-
- // Conversion to a point-type iterator.
+ /// Conversion to a point-type iterator.
inline
operator point_iterator_()
- {
- return (point_iterator_(
- const_cast<pointer>(const_iterator_::m_p_value)));
- }
+ { return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); }
- // Conversion to a point-type iterator.
+ /// Conversion to a point-type iterator.
inline
operator const point_iterator_() const
- {
- return (point_iterator_(
- const_cast<pointer>(const_iterator_::m_p_value)));
- }
+ { return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); }
- // Access.
- inline pointer
+ /// Access.
+ pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);
-
return (const_cast<pointer>(base_type::m_p_value));
}
- // Access.
- inline reference
+ /// Access.
+ reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);
-
return (const_cast<reference>(*base_type::m_p_value));
}
- // Increments.
- inline iterator_&
+ /// Increments.
+ iterator_&
operator++()
{
base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);
-
- return (*this);
+ return *this;
}
- // Increments.
- inline iterator_
+ /// Increments.
+ iterator_
operator++(int)
{
iterator_ ret =* this;
-
base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);
-
- return (ret);
+ return ret;
}
protected:
typedef const_iterator_ base_type;
-protected:
-
/**
* Constructor used by the table to initiate the generalized
* pointer and position (e.g., this is called from within a find()
* of a table.
* */
inline
- iterator_(pointer p_value, PB_DS_GEN_POS pos, PB_DS_CLASS_C_DEC* p_tbl) : const_iterator_(p_value, pos, p_tbl)
+ iterator_(pointer p_value, PB_DS_GEN_POS pos, PB_DS_CLASS_C_DEC* p_tbl)
+ : const_iterator_(p_value, pos, p_tbl)
{ }
friend class PB_DS_CLASS_C_DEC;
};
-
class point_iterator_;
-// Const point-type iterator.
+/// Const point-type iterator.
class point_const_iterator_
{
-
public:
-
- // Category.
+ /// Category.
typedef trivial_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef trivial_iterator_difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef value_type_ value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef pointer_ pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef reference_ reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef const_reference_ const_reference;
-public:
-
inline
point_const_iterator_(const_pointer p_value) : m_p_value(p_value)
{ }
- // Default constructor.
+ /// Default constructor.
inline
- point_const_iterator_()
-
- : m_p_value(0)
+ point_const_iterator_() : m_p_value(0)
{ }
- // Copy constructor.
+ /// Copy constructor.
inline
point_const_iterator_(const point_const_iterator_& other)
-
- : m_p_value(other.m_p_value)
+ : m_p_value(other.m_p_value)
{ }
- // Copy constructor.
+ /// Copy constructor.
inline
point_const_iterator_(const point_iterator_& other)
-
- : m_p_value(other.m_p_value)
+ : m_p_value(other.m_p_value)
{ }
- // Access.
- inline const_pointer
+ /// Access.
+ const_pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
-
- return (m_p_value);
+ return m_p_value;
}
- // Access.
- inline const_reference
+ /// Access.
+ const_reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
-
- return (*m_p_value);
+ return *m_p_value;
}
- // Compares content to a different iterator object.
- inline bool
+ /// Compares content to a different iterator object.
+ bool
operator==(const point_iterator_& other) const
- {
- return (m_p_value == other.m_p_value);
- }
+ { return m_p_value == other.m_p_value; }
- // Compares content to a different iterator object.
- inline bool
+ /// Compares content to a different iterator object.
+ bool
operator==(const point_const_iterator_& other) const
- {
- return (m_p_value == other.m_p_value);
- }
+ { return m_p_value == other.m_p_value; }
- // Compares content (negatively) to a different iterator object.
- inline bool
+ /// Compares content (negatively) to a different iterator object.
+ bool
operator!=(const point_iterator_& other) const
- {
- return (m_p_value != other.m_p_value);
- }
+ { return m_p_value != other.m_p_value; }
- // Compares content (negatively) to a different iterator object.
- inline bool
+ /// Compares content (negatively) to a different iterator object.
+ bool
operator!=(const point_const_iterator_& other) const
- {
- return (m_p_value != other.m_p_value);
- }
+ { return m_p_value != other.m_p_value; }
protected:
const_pointer m_p_value;
* methods.
*/
-// Find type iterator.
+/// Find type iterator.
class point_iterator_
{
-
public:
-
- // Category.
+ /// Category.
typedef trivial_iterator_tag iterator_category;
- // Difference type.
+ /// Difference type.
typedef trivial_iterator_difference_type difference_type;
- // Iterator's value type.
+ /// Iterator's value type.
typedef value_type_ value_type;
- // Iterator's pointer type.
+ /// Iterator's pointer type.
typedef pointer_ pointer;
- // Iterator's const pointer type.
+ /// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
- // Iterator's reference type.
+ /// Iterator's reference type.
typedef reference_ reference;
- // Iterator's const reference type.
+ /// Iterator's const reference type.
typedef const_reference_ const_reference;
-public:
-
- // Default constructor.
+ /// Default constructor.
inline
point_iterator_()
-
- : m_p_value(0)
+ : m_p_value(0)
{ }
- // Copy constructor.
+ /// Copy constructor.
inline
point_iterator_(const point_iterator_& other)
-
- : m_p_value(other.m_p_value)
+ : m_p_value(other.m_p_value)
{ }
- // Access.
- inline pointer
+ /// Access.
+ pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
-
return (m_p_value);
}
- // Access.
- inline reference
+ /// Access.
+ reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
-
return (*m_p_value);
}
- // Compares content to a different iterator object.
- inline bool
+ /// Compares content to a different iterator object.
+ bool
operator==(const point_iterator_& other) const
- {
- return (m_p_value == other.m_p_value);
- }
+ { return m_p_value == other.m_p_value; }
- // Compares content to a different iterator object.
- inline bool
+ /// Compares content to a different iterator object.
+ bool
operator==(const point_const_iterator_& other) const
- {
- return (m_p_value == other.m_p_value);
- }
+ { return m_p_value == other.m_p_value; }
- // Compares content to a different iterator object.
- inline bool
+ /// Compares content to a different iterator object.
+ bool
operator!=(const point_iterator_& other) const
- {
- return (m_p_value != other.m_p_value);
- }
+ { return m_p_value != other.m_p_value; }
- // Compares content (negatively) to a different iterator object.
- inline bool
+ /// Compares content (negatively) to a different iterator object.
+ bool
operator!=(const point_const_iterator_& other) const
- {
- return (m_p_value != other.m_p_value);
- }
+ { return m_p_value != other.m_p_value; }
inline
point_iterator_(pointer p_value) : m_p_value(p_value)
protected:
pointer m_p_value;
};
-
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
namespace __gnu_pbds
{
- // Base class for exceptions.
+ /**
+ * @defgroup exceptions-pbds Exceptions
+ * @ingroup pbds
+ * @{
+ */
+
+ /// Base class for exceptions.
struct container_error : public std::logic_error
{
- container_error()
+ container_error()
: std::logic_error(__N("__gnu_pbds::container_error")) { }
};
- // An entry cannot be inserted into a container object for logical
- // reasons (not, e.g., if memory is unabvailable, in which case
- // the allocator_type's exception will be thrown).
+ /// An entry cannot be inserted into a container object for logical
+ /// reasons (not, e.g., if memory is unabvailable, in which case
+ /// the allocator_type's exception will be thrown).
struct insert_error : public container_error { };
- // A join cannot be performed logical reasons (i.e., the ranges of
- // the two container objects being joined overlaps.
+ /// A join cannot be performed logical reasons (i.e., the ranges of
+ /// the two container objects being joined overlaps.
struct join_error : public container_error { };
- // A container cannot be resized.
+ /// A container cannot be resized.
struct resize_error : public container_error { };
#if __EXCEPTIONS
__throw_resize_error(void)
{ std::abort(); }
#endif
+ //@}
} // namespace __gnu_pbds
#endif
swap(PB_DS_CLASS_C_DEC& other);
protected:
- // Returns the i-th offset from the hash value.
+ /// Returns the i-th offset from the hash value.
inline size_type
operator()(size_type i) const;
};
swap(PB_DS_CLASS_C_DEC& other);
protected:
- // Returns the i-th offset from the hash value.
+ /// Returns the i-th offset from the hash value.
inline size_type
operator()(size_type i) const;
};
#define PB_DS_CLASS_T_DEC template<typename Size_Type>
#define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type>
- /// A mask range-hashing class (uses a bit-mask).
+ /// A mask range-hashing class (uses a bitmask).
template<typename Size_Type = std::size_t>
- class direct_mask_range_hashing
+ class direct_mask_range_hashing
: public detail::mask_based_range_hashing<Size_Type>
{
private:
void
notify_resized(size_type size);
- // Transforms the __hash value hash into a ranged-hash value
- // (using a bit-mask).
+ /// Transforms the __hash value hash into a ranged-hash value
+ /// (using a bit-mask).
inline size_type
operator()(size_type hash) const;
};
/// A mod range-hashing class (uses the modulo function).
template<typename Size_Type = std::size_t>
- class direct_mod_range_hashing
+ class direct_mod_range_hashing
: public detail::mod_based_range_hashing<Size_Type>
{
public:
typedef Size_Type size_type;
-
+
void
swap(PB_DS_CLASS_C_DEC& other);
protected:
void
notify_resized(size_type size);
-
- // Transforms the __hash value hash into a ranged-hash value
- // (using a modulo operation).
+
+ /// Transforms the __hash value hash into a ranged-hash value
+ /// (using a modulo operation).
inline size_type
operator()(size_type hash) const;
-
+
private:
typedef detail::mod_based_range_hashing<size_type> mod_based_base;
};
enum
{
+ /// Specifies whether the load factor can be accessed
+ /// externally. The two options have different trade-offs in
+ /// terms of flexibility, genericity, and encapsulation.
external_load_access = External_Load_Access
};
- // Default constructor, or constructor taking load_min and
- // load_max load factors between which this policy will keep the
- // actual load.
+ /// Default constructor, or constructor taking load_min and
+ /// load_max load factors between which this policy will keep the
+ /// actual load.
hash_load_check_resize_trigger(float load_min = 0.125,
float load_max = 0.5);
virtual
~hash_load_check_resize_trigger();
- // Returns a pair of the minimal and maximal loads, respectively.
+ /// Returns a pair of the minimal and maximal loads, respectively.
inline std::pair<float, float>
get_loads() const;
- // Sets the loads through a pair of the minimal and maximal
- // loads, respectively.
+ /// Sets the loads through a pair of the minimal and maximal
+ /// loads, respectively.
void
set_loads(std::pair<float, float> load_pair);
inline void
notify_erase_search_end();
- // Notifies an element was inserted. The total number of entries
- // in the table is num_entries.
+ /// Notifies an element was inserted. The total number of entries
+ /// in the table is num_entries.
inline void
notify_inserted(size_type num_entries);
inline void
notify_erased(size_type num_entries);
- // Notifies the table was cleared.
+ /// Notifies the table was cleared.
void
notify_cleared();
- // Notifies the table was resized as a result of this object's
- // signifying that a resize is needed.
+ /// Notifies the table was resized as a result of this object's
+ /// signifying that a resize is needed.
void
notify_resized(size_type new_size);
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char* file, int line) const;
-#endif
+#endif
float m_load_min;
float m_load_max;
class cc_hash_max_collision_check_resize_trigger
{
public:
- typedef Size_Type size_type;
+ typedef Size_Type size_type;
enum
{
+ /// Specifies whether the load factor can be accessed
+ /// externally. The two options have different trade-offs in
+ /// terms of flexibility, genericity, and encapsulation.
external_load_access = External_Load_Access
};
- // Default constructor, or constructor taking load, a __load
- // factor which it will attempt to maintain.
+ /// Default constructor, or constructor taking load, a __load
+ /// factor which it will attempt to maintain.
cc_hash_max_collision_check_resize_trigger(float load = 0.5);
void
swap(PB_DS_CLASS_C_DEC& other);
- // Returns the current load.
+ /// Returns the current load.
inline float
get_load() const;
- // Sets the load; does not resize the container.
+ /// Sets the load; does not resize the container.
void
set_load(float load);
protected:
+ /// Notifies an insert search started.
inline void
notify_insert_search_start();
+ /// Notifies a search encountered a collision.
inline void
notify_insert_search_collision();
+ /// Notifies a search ended.
inline void
notify_insert_search_end();
+ /// Notifies a find search started.
inline void
notify_find_search_start();
+ /// Notifies a search encountered a collision.
inline void
notify_find_search_collision();
+ /// Notifies a search ended.
inline void
notify_find_search_end();
+ /// Notifies an erase search started.
inline void
notify_erase_search_start();
+ /// Notifies a search encountered a collision.
inline void
notify_erase_search_collision();
+ /// Notifies a search ended.
inline void
notify_erase_search_end();
+ /// Notifies an element was inserted.
inline void
notify_inserted(size_type num_entries);
+ /// Notifies an element was erased.
inline void
notify_erased(size_type num_entries);
+ /// Notifies the table was cleared.
void
notify_cleared();
- // Notifies the table was resized as a result of this object's
- // signifying that a resize is needed.
+ /// Notifies the table was resized as a result of this object's
+ /// signifying that a resize is needed.
void
notify_resized(size_type new_size);
+ /// Notifies the table was resized externally.
void
notify_externally_resized(size_type new_size);
+ /// Queries whether a resize is needed.
inline bool
is_resize_needed() const;
+ /// Queries whether a grow is needed. This method is called only
+ /// if this object indicated is needed.
inline bool
is_grow_needed(size_type size, size_type num_entries) const;
public:
typedef Size_Type size_type;
- // Default constructor, or onstructor taking a start_size, or
- // constructor taking a start size and grow_factor. The policy
- // will use the sequence of sizes start_size, start_size*
- // grow_factor, start_size* grow_factor^2, ...
+ /// Default constructor, or onstructor taking a start_size, or
+ /// constructor taking a start size and grow_factor. The policy
+ /// will use the sequence of sizes start_size, start_size*
+ /// grow_factor, start_size* grow_factor^2, ...
hash_exponential_size_policy(size_type start_size = 8,
size_type grow_factor = 2);
class hash_prime_size_policy
{
public:
- // Size type.
+ /// Size type.
typedef std::size_t size_type;
- // Default constructor, or onstructor taking a start_size The
- // policy will use the sequence of sizes approximately
- // start_size, start_size* 2, start_size* 2^2, ...
+ /// Default constructor, or onstructor taking a start_size The
+ /// policy will use the sequence of sizes approximately
+ /// start_size, start_size* 2, start_size* 2^2, ...
hash_prime_size_policy(size_type start_size = 8);
inline void
typename Trigger_Policy = hash_load_check_resize_trigger<>,
bool External_Size_Access = false,
typename Size_Type = std::size_t>
- class hash_standard_resize_policy
+ class hash_standard_resize_policy
: public Size_Policy, public Trigger_Policy
{
public:
external_size_access = External_Size_Access
};
- // Default constructor.
+ /// Default constructor.
hash_standard_resize_policy();
- // constructor taking some policies r_size_policy will be copied
- // by the Size_Policy object of this object.
+ /// constructor taking some policies r_size_policy will be copied
+ /// by the Size_Policy object of this object.
hash_standard_resize_policy(const Size_Policy& r_size_policy);
- // constructor taking some policies. r_size_policy will be
- // copied by the Size_Policy object of this
- // object. r_trigger_policy will be copied by the Trigger_Policy
- // object of this object.
- hash_standard_resize_policy(const Size_Policy& r_size_policy,
+ /// constructor taking some policies. r_size_policy will be
+ /// copied by the Size_Policy object of this
+ /// object. r_trigger_policy will be copied by the Trigger_Policy
+ /// object of this object.
+ hash_standard_resize_policy(const Size_Policy& r_size_policy,
const Trigger_Policy& r_trigger_policy);
virtual
inline void
swap(PB_DS_CLASS_C_DEC& other);
- // Access to the Size_Policy object used.
- Size_Policy&
+ /// Access to the Size_Policy object used.
+ Size_Policy&
get_size_policy();
- // Const access to the Size_Policy object used.
- const Size_Policy&
+ /// Const access to the Size_Policy object used.
+ const Size_Policy&
get_size_policy() const;
- // Access to the Trigger_Policy object used.
- Trigger_Policy&
+ /// Access to the Trigger_Policy object used.
+ Trigger_Policy&
get_trigger_policy();
- // Access to the Trigger_Policy object used.
- const Trigger_Policy&
+ /// Access to the Trigger_Policy object used.
+ const Trigger_Policy&
get_trigger_policy() const;
- // Returns the actual size of the container.
+ /// Returns the actual size of the container.
inline size_type
get_actual_size() const;
- // Resizes the container to suggested_new_size, a suggested size
- // (the actual size will be determined by the Size_Policy
- // object).
+ /// Resizes the container to suggested_new_size, a suggested size
+ /// (the actual size will be determined by the Size_Policy
+ /// object).
void
resize(size_type suggested_new_size);
inline bool
is_resize_needed() const;
- // Queries what the new size should be, when the container is
- // resized naturally. The current __size of the container is
- // size, and the number of used entries within the container is
- // num_used_e.
+ /// Queries what the new size should be, when the container is
+ /// resized naturally. The current __size of the container is
+ /// size, and the number of used entries within the container is
+ /// num_used_e.
size_type
get_new_size(size_type size, size_type num_used_e) const;
private:
- // Resizes to new_size.
+ /// Resizes to new_size.
virtual void
do_resize(size_type new_size);
} // namespace __gnu_pbds
-#endif
+#endif
public:
typedef _Alloc allocator_type;
- // Metadata on which this functor operates.
+ /// Metadata on which this functor operates.
typedef null_type metadata_type;
private:
typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
public:
- // Reference to metadata on which this functor operates.
+ /// Reference to metadata on which this functor operates.
typedef typename __rebind_m::other::reference metadata_reference;
- // Creates a metadata object.
+ /// Creates a metadata object.
metadata_type
operator()() const
{ return s_metadata; }
- // Decides whether a metadata object should be moved to the front
- // of the list.
+ /// Decides whether a metadata object should be moved to the front
+ /// of the list.
inline bool
operator()(metadata_reference r_metadata) const
{ return true; }
enum
{
+ /// When some element is accessed this number of times, it
+ /// will be moved to the front of the list.
max_count = Max_Count
};
- // Metadata on which this functor operates.
+ /// Metadata on which this functor operates.
typedef detail::lu_counter_metadata<size_type> metadata_type;
private:
typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
public:
- // Reference to metadata on which this functor operates.
+ /// Reference to metadata on which this functor operates.
typedef typename __rebind_m::other::reference metadata_reference;
- // Creates a metadata object.
+ /// Creates a metadata object.
metadata_type
operator()() const
{ return base_type::operator()(max_count); }
- // Decides whether a metadata object should be moved to the front
- // of the list.
+ /// Decides whether a metadata object should be moved to the front
+ /// of the list.
bool
operator()(metadata_reference r_data) const
{ return base_type::operator()(r_data, max_count); }
namespace __gnu_pbds
{
/**
- * @brief A priority queue composed of one specific heap policy.
- * @ingroup pbds
+ * @defgroup heap-based
+ * @ingroup containers-pbds
+ * @{
*/
- template<typename _Tv,
+
+ /**
+ * @defgroup heap-detail Base and Policy Classes
+ * @ingroup heap-based
+ */
+
+ /**
+ * A priority queue composed of one specific heap policy.
+ *
+ * @tparam _Tv Value type.
+ * @tparam Cmp_Fn Comparison functor.
+ * @tparam Tag Instantiating data structure type,
+ * see container_tag.
+ * @tparam _Alloc Allocator type.
+ *
+ * Base is dispatched at compile time via Tag, from the following
+ * choices: binary_heap_tag, binomial_heap_tag, pairing_heap_tag,
+ * rc_binomial_heap_tag, thin_heap_tag
+ *
+ * Base choices are: detail::binary_heap, detail::binomial_heap,
+ * detail::pairing_heap, detail::rc_binomial_heap,
+ * detail::thin_heap.
+ */
+ template<typename _Tv,
typename Cmp_Fn = std::less<_Tv>,
typename Tag = pairing_heap_tag,
typename _Alloc = std::allocator<char> >
priority_queue() { }
- // Constructor taking some policy objects. r_cmp_fn will be copied
- // by the Cmp_Fn object of the container object.
+ /// Constructor taking some policy objects. r_cmp_fn will be
+ /// copied by the Cmp_Fn object of the container object.
priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { }
- // Constructor taking __iterators to a range of value_types. The
- // value_types between first_it and last_it will be inserted into
- // the container object.
+ /// Constructor taking __iterators to a range of value_types. The
+ /// value_types between first_it and last_it will be inserted into
+ /// the container object.
template<typename It>
priority_queue(It first_it, It last_it)
{ base_type::copy_from_range(first_it, last_it); }
- // Constructor taking __iterators to a range of value_types and
- // some policy objects The value_types between first_it and
- // last_it will be inserted into the container object. r_cmp_fn
- // will be copied by the cmp_fn object of the container object.
+ /// Constructor taking __iterators to a range of value_types and
+ /// some policy objects The value_types between first_it and
+ /// last_it will be inserted into the container object. r_cmp_fn
+ /// will be copied by the cmp_fn object of the container object.
template<typename It>
priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn)
: base_type(r_cmp_fn)
{ base_type::swap(other); }
};
} // namespace __gnu_pbds
-
+ //@} heap-based
#endif
* @{
*/
/// A trivial iterator tag. Signifies that the iterators has none of
- /// the STL's movement abilities.
+ /// std::iterators's movement abilities.
struct trivial_iterator_tag
{ };
/**
- * @defgroup invalidation_tags Invalidation Guarantees.
+ * @defgroup invalidation_tags Invalidation Guarantees
* @ingroup tags
* @{
*/
/**
- * @defgroup ds_tags Data Structure Tag Hierarchy.
+ * @defgroup ds_tags Data Structure Type
* @ingroup tags
* @{
*/
/// Basic branch structure.
struct basic_branch_tag : public associative_tag { };
- /// tree.
+ /// Basic tree structure.
struct tree_tag : public basic_branch_tag { };
/// Red-black tree.
/// Ordered-vector tree.
struct ov_tree_tag : public tree_tag { };
- /// trie.
+ /// Basic trie structure.
struct trie_tag : public basic_branch_tag { };
/// PATRICIA trie.
*/
struct null_type { };
+ /// A null node updator, indicating that no node updates are required.
+ template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
+ struct null_node_update : public null_type
+ { };
+
/// Primary template, container traits base.
template<typename _Tag>
template<>
struct container_traits_base<cc_hash_tag>
{
- typedef cc_hash_tag container_category;
- typedef point_invalidation_guarantee invalidation_guarantee;
+ typedef cc_hash_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<gp_hash_tag>
{
- typedef gp_hash_tag container_category;
- typedef basic_invalidation_guarantee invalidation_guarantee;
+ typedef gp_hash_tag container_category;
+ typedef basic_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<rb_tree_tag>
{
- typedef rb_tree_tag container_category;
- typedef range_invalidation_guarantee invalidation_guarantee;
+ typedef rb_tree_tag container_category;
+ typedef range_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<splay_tree_tag>
{
- typedef splay_tree_tag container_category;
- typedef range_invalidation_guarantee invalidation_guarantee;
+ typedef splay_tree_tag container_category;
+ typedef range_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<ov_tree_tag>
{
- typedef ov_tree_tag container_category;
- typedef basic_invalidation_guarantee invalidation_guarantee;
+ typedef ov_tree_tag container_category;
+ typedef basic_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<pat_trie_tag>
{
- typedef pat_trie_tag container_category;
- typedef range_invalidation_guarantee invalidation_guarantee;
+ typedef pat_trie_tag container_category;
+ typedef range_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<list_update_tag>
{
- typedef list_update_tag container_category;
- typedef point_invalidation_guarantee invalidation_guarantee;
+ typedef list_update_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<pairing_heap_tag>
{
- typedef pairing_heap_tag container_category;
- typedef point_invalidation_guarantee invalidation_guarantee;
+ typedef pairing_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<thin_heap_tag>
{
- typedef thin_heap_tag container_category;
- typedef point_invalidation_guarantee invalidation_guarantee;
+ typedef thin_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<binomial_heap_tag>
{
- typedef binomial_heap_tag container_category;
- typedef point_invalidation_guarantee invalidation_guarantee;
+ typedef binomial_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<rc_binomial_heap_tag>
{
- typedef rc_binomial_heap_tag container_category;
- typedef point_invalidation_guarantee invalidation_guarantee;
+ typedef rc_binomial_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
template<>
struct container_traits_base<binary_heap_tag>
{
- typedef binary_heap_tag container_category;
- typedef basic_invalidation_guarantee invalidation_guarantee;
+ typedef binary_heap_tag container_category;
+ typedef basic_invalidation_guarantee invalidation_guarantee;
enum
{
enum
{
+ /// True only if Cntnr objects guarantee storing keys by order.
order_preserving = base_type::order_preserving,
+
+ /// True only if erasing a key can throw.
erase_can_throw = base_type::erase_can_throw,
+
+ /// True only if split or join operations can throw.
split_join_can_throw = base_type::split_join_can_throw,
+
+ /// True only reverse iterators are supported.
reverse_iteration = base_type::reverse_iteration
};
};
typedef typename node_const_iterator::value_type const_iterator;
typedef typename node_iterator::value_type iterator;
- // Finds an entry by __order. Returns a const_iterator to the
- // entry with the __order order, or a const_iterator to the
- // container object's end if order is at least the size of the
- // container object.
+ /// Finds an entry by __order. Returns a const_iterator to the
+ /// entry with the __order order, or a const_iterator to the
+ /// container object's end if order is at least the size of the
+ /// container object.
inline const_iterator
find_by_order(size_type) const;
- // Finds an entry by __order. Returns an iterator to the entry
- // with the __order order, or an iterator to the container
- // object's end if order is at least the size of the container
- // object.
+ /// Finds an entry by __order. Returns an iterator to the entry
+ /// with the __order order, or an iterator to the container
+ /// object's end if order is at least the size of the container
+ /// object.
inline iterator
find_by_order(size_type);
- // Returns the order of a key within a sequence. For exapmle, if
- // r_key is the smallest key, this method will return 0; if r_key
- // is a key between the smallest and next key, this method will
- // return 1; if r_key is a key larger than the largest key, this
- // method will return the size of r_c.
+ /// Returns the order of a key within a sequence. For exapmle, if
+ /// r_key is the smallest key, this method will return 0; if r_key
+ /// is a key between the smallest and next key, this method will
+ /// return 1; if r_key is a key larger than the largest key, this
+ /// method will return the size of r_c.
inline size_type
order_of_key(key_const_reference) const;
private:
- // Const reference to the container's value-type.
+ /// Const reference to the container's value-type.
typedef typename base_type::const_reference const_reference;
- // Const pointer to the container's value-type.
+ /// Const pointer to the container's value-type.
typedef typename base_type::const_pointer const_pointer;
typedef typename _Alloc::template rebind<metadata_type>::other __rebind_m;
- // Const metadata reference.
+ /// Const metadata reference.
typedef typename __rebind_m::const_reference metadata_const_reference;
- // Metadata reference.
+ /// Metadata reference.
typedef typename __rebind_m::reference metadata_reference;
- // Returns the node_const_iterator associated with the tree's root node.
+ /// Returns the node_const_iterator associated with the tree's root node.
virtual node_const_iterator
node_begin() const = 0;
- // Returns the node_iterator associated with the tree's root node.
+ /// Returns the node_iterator associated with the tree's root node.
virtual node_iterator
node_begin() = 0;
- // Returns the node_const_iterator associated with a just-after leaf node.
+ /// Returns the node_const_iterator associated with a just-after leaf node.
virtual node_const_iterator
node_end() const = 0;
- // Returns the node_iterator associated with a just-after leaf node.
+ /// Returns the node_iterator associated with a just-after leaf node.
virtual node_iterator
node_end() = 0;
- // Access to the cmp_fn object.
+ /// Access to the cmp_fn object.
virtual cmp_fn&
get_cmp_fn() = 0;
protected:
- // Updates the rank of a node through a node_iterator node_it;
- // end_nd_it is the end node iterator.
+ /// Updates the rank of a node through a node_iterator node_it;
+ /// end_nd_it is the end node iterator.
inline void
operator()(node_iterator, node_const_iterator) const;
#define PB_DS_CLASS_C_DEC \
trie_string_access_traits<String, Min_E_Val,Max_E_Val,Reverse,_Alloc>
- /// Element access traits for string types.
+ /**
+ * Element access traits for string types.
+ *
+ * @tparam String String type.
+ * @tparam Min_E_Val Minimal element value.
+ * @tparam Max_E_Val Maximum element value.
+ * @tparam Reverse Reverse iteration should be used.
+ * Default: false.
+ * @tparam _Alloc Allocator type.
+ */
template<typename String = std::string,
typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min,
typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max,
reverse = Reverse
};
- // Element const iterator type.
+ /// Element const iterator type.
typedef typename detail::__conditional_type<Reverse, \
typename String::const_reverse_iterator, \
typename String::const_iterator>::__type const_iterator;
- // Element type.
+ /// Element type.
typedef typename std::iterator_traits<const_iterator>::value_type e_type;
enum
};
PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2);
- // Returns a const_iterator to the first element of
- // key_const_reference agumnet.
+ /// Returns a const_iterator to the first element of
+ /// key_const_reference agumnet.
inline static const_iterator
begin(key_const_reference);
- // Returns a const_iterator to the after-last element of
- // key_const_reference argument.
+ /// Returns a const_iterator to the after-last element of
+ /// key_const_reference argument.
inline static const_iterator
end(key_const_reference);
- // Maps an element to a position.
+ /// Maps an element to a position.
inline static size_type
e_pos(e_type e);
typedef typename base_type::key_type key_type;
typedef typename base_type::key_const_reference key_const_reference;
- // Element access traits.
+ /// Element access traits.
typedef _ATraits access_traits;
- // Const element iterator.
+ /// Const element iterator.
typedef typename access_traits::const_iterator a_const_iterator;
- // _Alloc type.
+ /// _Alloc type.
typedef _Alloc allocator_type;
- // Size type.
+ /// Size type.
typedef typename allocator_type::size_type size_type;
typedef null_type metadata_type;
typedef Node_Itr node_iterator;
typedef typename node_iterator::value_type iterator;
typedef typename node_const_iterator::value_type const_iterator;
- // Finds the const iterator range corresponding to all values
- // whose prefixes match r_key.
+ /// Finds the const iterator range corresponding to all values
+ /// whose prefixes match r_key.
std::pair<const_iterator, const_iterator>
prefix_range(key_const_reference) const;
- // Finds the iterator range corresponding to all values whose
- // prefixes match r_key.
+ /// Finds the iterator range corresponding to all values whose
+ /// prefixes match r_key.
std::pair<iterator, iterator>
prefix_range(key_const_reference);
- // Finds the const iterator range corresponding to all values
- // whose prefixes match [b, e).
+ /// Finds the const iterator range corresponding to all values
+ /// whose prefixes match [b, e).
std::pair<const_iterator, const_iterator>
prefix_range(a_const_iterator, a_const_iterator) const;
- // Finds the iterator range corresponding to all values whose
- // prefixes match [b, e).
+ /// Finds the iterator range corresponding to all values whose
+ /// prefixes match [b, e).
std::pair<iterator, iterator>
prefix_range(a_const_iterator, a_const_iterator);
protected:
- // Called to update a node's metadata.
+ /// Called to update a node's metadata.
inline void
operator()(node_iterator node_it, node_const_iterator end_nd_it) const;
next_child(node_iterator, a_const_iterator, a_const_iterator,
node_iterator, const access_traits&);
- // Returns the const iterator associated with the just-after last element.
+ /// Returns the const iterator associated with the just-after last element.
virtual const_iterator
end() const = 0;
- // Returns the iterator associated with the just-after last element.
+ /// Returns the iterator associated with the just-after last element.
virtual iterator
end() = 0;
- // Returns the node_const_iterator associated with the trie's root node.
+ /// Returns the node_const_iterator associated with the trie's root node.
virtual node_const_iterator
node_begin() const = 0;
- // Returns the node_iterator associated with the trie's root node.
+ /// Returns the node_iterator associated with the trie's root node.
virtual node_iterator
node_begin() = 0;
- // Returns the node_const_iterator associated with a just-after leaf node.
+ /// Returns the node_const_iterator associated with a just-after leaf node.
virtual node_const_iterator
node_end() const = 0;
- // Returns the node_iterator associated with a just-after leaf node.
+ /// Returns the node_iterator associated with a just-after leaf node.
virtual node_iterator
node_end() = 0;
- // Access to the cmp_fn object.
+ /// Access to the cmp_fn object.
virtual const access_traits&
get_access_traits() const = 0;
};
typedef typename node_const_iterator::value_type const_iterator;
typedef typename node_iterator::value_type iterator;
- // Finds an entry by __order. Returns a const_iterator to the
- // entry with the __order order, or a const_iterator to the
- // container object's end if order is at least the size of the
- // container object.
+ /// Finds an entry by __order. Returns a const_iterator to the
+ /// entry with the __order order, or a const_iterator to the
+ /// container object's end if order is at least the size of the
+ /// container object.
inline const_iterator
find_by_order(size_type) const;
- // Finds an entry by __order. Returns an iterator to the entry
- // with the __order order, or an iterator to the container
- // object's end if order is at least the size of the container
- // object.
+ /// Finds an entry by __order. Returns an iterator to the entry
+ /// with the __order order, or an iterator to the container
+ /// object's end if order is at least the size of the container
+ /// object.
inline iterator
find_by_order(size_type);
- // Returns the order of a key within a sequence. For exapmle, if
- // r_key is the smallest key, this method will return 0; if r_key
- // is a key between the smallest and next key, this method will
- // return 1; if r_key is a key larger than the largest key, this
- // method will return the size of r_c.
+ /// Returns the order of a key within a sequence. For exapmle, if
+ /// r_key is the smallest key, this method will return 0; if r_key
+ /// is a key between the smallest and next key, this method will
+ /// return 1; if r_key is a key larger than the largest key, this
+ /// method will return the size of r_c.
inline size_type
order_of_key(key_const_reference) const;
- // Returns the order of a prefix within a sequence. For exapmle,
- // if [b, e] is the smallest prefix, this method will return 0; if
- // r_key is a key between the smallest and next key, this method
- // will return 1; if r_key is a key larger than the largest key,
- // this method will return the size of r_c.
+ /// Returns the order of a prefix within a sequence. For exapmle,
+ /// if [b, e] is the smallest prefix, this method will return 0; if
+ /// r_key is a key between the smallest and next key, this method
+ /// will return 1; if r_key is a key larger than the largest key,
+ /// this method will return the size of r_c.
inline size_type
order_of_prefix(a_const_iterator, a_const_iterator) const;
protected:
- // Updates the rank of a node through a node_iterator node_it;
- // end_nd_it is the end node iterator.
+ /// Updates the rank of a node through a node_iterator node_it;
+ /// end_nd_it is the end node iterator.
inline void
operator()(node_iterator, node_const_iterator) const;
typedef typename __rebind_ma::const_reference metadata_const_reference;
typedef typename __rebind_ma::reference metadata_reference;
- // Returns true if the container is empty.
+ /// Returns true if the container is empty.
virtual bool
empty() const = 0;
- // Returns the iterator associated with the trie's first element.
+ /// Returns the iterator associated with the trie's first element.
virtual iterator
begin() = 0;
- // Returns the iterator associated with the trie's
- // just-after-last element.
+ /// Returns the iterator associated with the trie's
+ /// just-after-last element.
virtual iterator
end() = 0;
- // Returns the node_const_iterator associated with the trie's root node.
+ /// Returns the node_const_iterator associated with the trie's root node.
virtual node_const_iterator
node_begin() const = 0;
- // Returns the node_iterator associated with the trie's root node.
+ /// Returns the node_iterator associated with the trie's root node.
virtual node_iterator
node_begin() = 0;
- // Returns the node_const_iterator associated with a just-after
- // leaf node.
+ /// Returns the node_const_iterator associated with a just-after
+ /// leaf node.
virtual node_const_iterator
node_end() const = 0;
- // Returns the node_iterator associated with a just-after leaf node.
+ /// Returns the node_iterator associated with a just-after leaf node.
virtual node_iterator
node_end() = 0;
- // Access to the cmp_fn object.
+ /// Access to the cmp_fn object.
virtual access_traits&
get_access_traits() = 0;
};