3 // Copyright (C) 2005-2014 Free Software Foundation, Inc.
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
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.
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.
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/>.
25 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
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
37 * @file binary_heap_/point_const_iterator.hpp
38 * Contains an iterator class returned by the table's const find and insert
42 #ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP
43 #define PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP
45 #include <ext/pb_ds/tag_and_trait.hpp>
46 #include <debug/debug.h>
52 /// Const point-type iterator.
53 template<typename Value_Type, typename Entry, bool Simple,
55 class binary_heap_point_const_iterator_
58 typedef typename _Alloc::template rebind<Entry>::other::pointer entry_pointer;
62 typedef trivial_iterator_tag iterator_category;
65 typedef trivial_iterator_difference_type difference_type;
67 /// Iterator's value type.
68 typedef Value_Type value_type;
70 /// Iterator's pointer type.
71 typedef typename _Alloc::template rebind<value_type>::other::pointer
74 /// Iterator's const pointer type.
76 typename _Alloc::template rebind<value_type>::other::const_pointer
79 /// Iterator's reference type.
81 typename _Alloc::template rebind<value_type>::other::reference
84 /// Iterator's const reference type.
86 typename _Alloc::template rebind<value_type>::other::const_reference
90 binary_heap_point_const_iterator_(entry_pointer p_e) : m_p_e(p_e)
93 /// Default constructor.
95 binary_heap_point_const_iterator_() : m_p_e(0) { }
99 binary_heap_point_const_iterator_(const binary_heap_point_const_iterator_& other)
107 _GLIBCXX_DEBUG_ASSERT(m_p_e != 0);
108 return to_ptr(integral_constant<int, Simple>());
112 inline const_reference
115 _GLIBCXX_DEBUG_ASSERT(m_p_e != 0);
116 return *to_ptr(integral_constant<int, Simple>());
119 /// Compares content to a different iterator object.
121 operator==(const binary_heap_point_const_iterator_& other) const
122 { return m_p_e == other.m_p_e; }
124 /// Compares content (negatively) to a different iterator object.
126 operator!=(const binary_heap_point_const_iterator_& other) const
127 { return m_p_e != other.m_p_e; }
131 to_ptr(true_type) const
135 to_ptr(false_type) const
141 } // namespace detail
142 } // namespace __gnu_pbds