// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2005-2014 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
{
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
-