]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp
Update copyright in libstdc++-v3.
[thirdparty/gcc.git] / libstdc++-v3 / include / ext / pb_ds / detail / left_child_next_sibling_heap_ / point_const_iterator.hpp
CommitLineData
4569a895
AT
1// -*- C++ -*-
2
405feeb8 3// Copyright (C) 2005-2013 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 48namespace __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:
a345e45d 64 typedef typename _Alloc::template rebind<Node>::other::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.
4569a895 77 typedef
a345e45d 78 typename _Alloc::template rebind<
4569a895
AT
79 value_type>::other::pointer
80 pointer;
81
30a96b3b 82 /// Iterator's const pointer type.
4569a895 83 typedef
a345e45d 84 typename _Alloc::template rebind<
4569a895
AT
85 value_type>::other::const_pointer
86 const_pointer;
87
30a96b3b 88 /// Iterator's reference type.
4569a895 89 typedef
a345e45d 90 typename _Alloc::template rebind<
4569a895
AT
91 value_type>::other::reference
92 reference;
93
30a96b3b 94 /// Iterator's const reference type.
4569a895 95 typedef
a345e45d 96 typename _Alloc::template rebind<
4569a895
AT
97 value_type>::other::const_reference
98 const_reference;
99
4569a895 100 inline
a345e45d 101 left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
4569a895
AT
102 { }
103
30a96b3b 104 /// Default constructor.
4569a895 105 inline
a345e45d 106 left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0)
4569a895
AT
107 { }
108
30a96b3b 109 /// Copy constructor.
4569a895 110 inline
a345e45d 111 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
112 { }
113
30a96b3b
BK
114 /// Access.
115 const_pointer
4569a895
AT
116 operator->() const
117 {
8fc81078 118 _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
47bea7b8 119 return &m_p_nd->m_value;
4569a895
AT
120 }
121
30a96b3b
BK
122 /// Access.
123 const_reference
4569a895
AT
124 operator*() const
125 {
8fc81078 126 _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
47bea7b8 127 return m_p_nd->m_value;
4569a895
AT
128 }
129
30a96b3b
BK
130 /// Compares content to a different iterator object.
131 bool
4569a895 132 operator==(const PB_DS_CLASS_C_DEC& other) const
47bea7b8 133 { return m_p_nd == other.m_p_nd; }
4569a895 134
30a96b3b
BK
135 /// Compares content (negatively) to a different iterator object.
136 bool
4569a895 137 operator!=(const PB_DS_CLASS_C_DEC& other) const
47bea7b8 138 { return m_p_nd != other.m_p_nd; }
4569a895 139
4569a895
AT
140 node_pointer m_p_nd;
141 };
142
143#undef PB_DS_CLASS_T_DEC
144#undef PB_DS_CLASS_C_DEC
145
4569a895 146 } // namespace detail
5e11f978 147} // namespace __gnu_pbds
4569a895 148
30a96b3b 149#endif