]>
Commit | Line | Data |
---|---|---|
4569a895 AT |
1 | // -*- C++ -*- |
2 | ||
7adcbafe | 3 | // Copyright (C) 2005-2022 Free Software Foundation, Inc. |
4569a895 AT |
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 | |
748086b7 | 8 | // Foundation; either version 3, or (at your option) any later |
4569a895 AT |
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 | ||
748086b7 JJ |
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. | |
4569a895 | 19 | |
748086b7 JJ |
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/>. | |
4569a895 AT |
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 | /** | |
a345e45d | 37 | * @file left_child_next_sibling_heap_/point_const_iterator.hpp |
4569a895 | 38 | * Contains an iterator class returned by the table's const find and insert |
a345e45d | 39 | * methods. |
4569a895 AT |
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 | ||
45 | #include <ext/pb_ds/tag_and_trait.hpp> | |
47bea7b8 | 46 | #include <debug/debug.h> |
4569a895 | 47 | |
5e11f978 | 48 | namespace __gnu_pbds |
4569a895 AT |
49 | { |
50 | namespace detail | |
51 | { | |
52 | ||
4569a895 | 53 | #define PB_DS_CLASS_T_DEC \ |
a345e45d | 54 | template<typename Node, typename _Alloc> |
4569a895 | 55 | |
47bea7b8 | 56 | #define PB_DS_CLASS_C_DEC \ |
a345e45d | 57 | left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc> |
4569a895 | 58 | |
a345e45d BK |
59 | /// Const point-type iterator. |
60 | template<typename Node, typename _Alloc> | |
61 | class left_child_next_sibling_heap_node_point_const_iterator_ | |
4569a895 | 62 | { |
4569a895 | 63 | protected: |
ec541f1b | 64 | typedef typename rebind_traits<_Alloc, Node>::pointer node_pointer; |
4569a895 AT |
65 | |
66 | public: | |
30a96b3b | 67 | /// Category. |
4569a895 AT |
68 | typedef trivial_iterator_tag iterator_category; |
69 | ||
30a96b3b | 70 | /// Difference type. |
4569a895 AT |
71 | typedef trivial_iterator_difference_type difference_type; |
72 | ||
30a96b3b | 73 | /// Iterator's value type. |
4569a895 AT |
74 | typedef typename Node::value_type value_type; |
75 | ||
30a96b3b | 76 | /// Iterator's pointer type. |
ec541f1b | 77 | typedef typename rebind_traits<_Alloc, value_type>::pointer pointer; |
4569a895 | 78 | |
30a96b3b | 79 | /// Iterator's const pointer type. |
ec541f1b JW |
80 | typedef typename rebind_traits<_Alloc, value_type>::const_pointer |
81 | const_pointer; | |
4569a895 | 82 | |
30a96b3b | 83 | /// Iterator's reference type. |
ec541f1b | 84 | typedef typename rebind_traits<_Alloc, value_type>::reference reference; |
4569a895 | 85 | |
30a96b3b | 86 | /// Iterator's const reference type. |
ec541f1b JW |
87 | typedef typename rebind_traits<_Alloc, value_type>::const_reference |
88 | const_reference; | |
4569a895 | 89 | |
4569a895 | 90 | inline |
a345e45d | 91 | left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd) |
4569a895 AT |
92 | { } |
93 | ||
30a96b3b | 94 | /// Default constructor. |
4569a895 | 95 | inline |
a345e45d | 96 | left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0) |
4569a895 AT |
97 | { } |
98 | ||
30a96b3b | 99 | /// Copy constructor. |
4569a895 | 100 | inline |
a345e45d | 101 | left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd) |
4569a895 AT |
102 | { } |
103 | ||
30a96b3b BK |
104 | /// Access. |
105 | const_pointer | |
4569a895 AT |
106 | operator->() const |
107 | { | |
8fc81078 | 108 | _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); |
47bea7b8 | 109 | return &m_p_nd->m_value; |
4569a895 AT |
110 | } |
111 | ||
30a96b3b BK |
112 | /// Access. |
113 | const_reference | |
4569a895 AT |
114 | operator*() const |
115 | { | |
8fc81078 | 116 | _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); |
47bea7b8 | 117 | return m_p_nd->m_value; |
4569a895 AT |
118 | } |
119 | ||
30a96b3b BK |
120 | /// Compares content to a different iterator object. |
121 | bool | |
4569a895 | 122 | operator==(const PB_DS_CLASS_C_DEC& other) const |
47bea7b8 | 123 | { return m_p_nd == other.m_p_nd; } |
4569a895 | 124 | |
30a96b3b BK |
125 | /// Compares content (negatively) to a different iterator object. |
126 | bool | |
4569a895 | 127 | operator!=(const PB_DS_CLASS_C_DEC& other) const |
47bea7b8 | 128 | { return m_p_nd != other.m_p_nd; } |
4569a895 | 129 | |
4569a895 AT |
130 | node_pointer m_p_nd; |
131 | }; | |
132 | ||
133 | #undef PB_DS_CLASS_T_DEC | |
134 | #undef PB_DS_CLASS_C_DEC | |
135 | ||
4569a895 | 136 | } // namespace detail |
5e11f978 | 137 | } // namespace __gnu_pbds |
4569a895 | 138 | |
30a96b3b | 139 | #endif |