libstdc++
left_child_next_sibling_heap_/point_const_iterator.hpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 // Copyright (C) 2005-2020 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3, or (at your option) any later
9 // version.
10 
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
24 
25 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
26 
27 // Permission to use, copy, modify, sell, and distribute this software
28 // is hereby granted without fee, provided that the above copyright
29 // notice appears in all copies, and that both that copyright notice
30 // and this permission notice appear in supporting documentation. None
31 // of the above authors, nor IBM Haifa Research Laboratories, make any
32 // representation about the suitability of this software for any
33 // purpose. It is provided "as is" without express or implied
34 // warranty.
35 
36 /**
37  * @file left_child_next_sibling_heap_/point_const_iterator.hpp
38  * Contains an iterator class returned by the table's const find and insert
39  * methods.
40  */
41 
42 #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
43 #define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
44 
46 #include <debug/debug.h>
47 
48 namespace __gnu_pbds
49 {
50  namespace detail
51  {
52 
53 #define PB_DS_CLASS_T_DEC \
54  template<typename Node, typename _Alloc>
55 
56 #define PB_DS_CLASS_C_DEC \
57  left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>
58 
59  /// Const point-type iterator.
60  template<typename Node, typename _Alloc>
62  {
63  protected:
64  typedef typename rebind_traits<_Alloc, Node>::pointer node_pointer;
65 
66  public:
67  /// Category.
69 
70  /// Difference type.
72 
73  /// Iterator's value type.
74  typedef typename Node::value_type value_type;
75 
76  /// Iterator's pointer type.
78 
79  /// Iterator's const pointer type.
82 
83  /// Iterator's reference type.
84  typedef typename rebind_traits<_Alloc, value_type>::reference reference;
85 
86  /// Iterator's const reference type.
87  typedef typename rebind_traits<_Alloc, value_type>::const_reference
89 
90  inline
91  left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
92  { }
93 
94  /// Default constructor.
95  inline
97  { }
98 
99  /// Copy constructor.
100  inline
101  left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
102  { }
103 
104  /// Access.
106  operator->() const
107  {
108  _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
109  return &m_p_nd->m_value;
110  }
111 
112  /// Access.
114  operator*() const
115  {
116  _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
117  return m_p_nd->m_value;
118  }
119 
120  /// Compares content to a different iterator object.
121  bool
122  operator==(const PB_DS_CLASS_C_DEC& other) const
123  { return m_p_nd == other.m_p_nd; }
124 
125  /// Compares content (negatively) to a different iterator object.
126  bool
127  operator!=(const PB_DS_CLASS_C_DEC& other) const
128  { return m_p_nd != other.m_p_nd; }
129 
130  node_pointer m_p_nd;
131  };
132 
133 #undef PB_DS_CLASS_T_DEC
134 #undef PB_DS_CLASS_C_DEC
135 
136  } // namespace detail
137 } // namespace __gnu_pbds
138 
139 #endif
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::operator*
const_reference operator*() const
Access.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:114
__gnu_pbds::trivial_iterator_tag
A trivial iterator tag. Signifies that the iterators has none of std::iterators's movement abilities.
Definition: tag_and_trait.hpp:75
__gnu_pbds
GNU extensions for policy-based data structures for public use.
Definition: assoc_container.hpp:51
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::operator->
const_pointer operator->() const
Access.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:106
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::operator==
bool operator==(const left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc > &other) const
Compares content to a different iterator object.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:122
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::const_pointer
rebind_traits< _Alloc, value_type >::const_pointer const_pointer
Iterator's const pointer type.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:81
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::operator!=
bool operator!=(const left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc > &other) const
Compares content (negatively) to a different iterator object.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:127
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::difference_type
trivial_iterator_difference_type difference_type
Difference type.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:71
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_
Const point-type iterator.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:61
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::left_child_next_sibling_heap_node_point_const_iterator_
left_child_next_sibling_heap_node_point_const_iterator_(const left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc > &other)
Copy constructor.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:101
__gnu_pbds::trivial_iterator_difference_type
void trivial_iterator_difference_type
Prohibit moving trivial iterators.
Definition: tag_and_trait.hpp:79
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::iterator_category
trivial_iterator_tag iterator_category
Category.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:68
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::value_type
Node::value_type value_type
Iterator's value type.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:74
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::reference
rebind_traits< _Alloc, value_type >::reference reference
Iterator's reference type.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:84
__gnu_pbds::detail::rebind_traits
Consistent API for accessing allocator-related types.
Definition: types_traits.hpp:137
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::const_reference
rebind_traits< _Alloc, value_type >::const_reference const_reference
Iterator's const reference type.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:88
debug.h
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::pointer
rebind_traits< _Alloc, value_type >::pointer pointer
Iterator's pointer type.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:77
__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_::left_child_next_sibling_heap_node_point_const_iterator_
left_child_next_sibling_heap_node_point_const_iterator_()
Default constructor.
Definition: left_child_next_sibling_heap_/point_const_iterator.hpp:96
tag_and_trait.hpp