STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
const_iterator.hpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 // Copyright (C) 2005-2013 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 
42 #ifndef PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
43 #define PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
44 
46 #include <debug/debug.h>
47 
48 namespace __gnu_pbds
49 {
50  namespace detail
51  {
52 #define PB_DS_BIN_HEAP_CIT_BASE \
53  binary_heap_point_const_iterator_<Value_Type, Entry, Simple, _Alloc>
54 
56  template<typename Value_Type,
57  typename Entry,
58  bool Simple,
59  typename _Alloc>
61  {
62  private:
64  typedef typename base_type::entry_pointer entry_pointer;
65 
66  public:
68  typedef std::forward_iterator_tag iterator_category;
69 
71  typedef typename _Alloc::difference_type difference_type;
72 
74  typedef typename base_type::value_type value_type;
75 
77  typedef typename base_type::pointer pointer;
78 
80  typedef typename base_type::const_pointer const_pointer;
81 
83  typedef typename base_type::reference reference;
84 
86  typedef typename base_type::const_reference const_reference;
87 
88  inline
90  { }
91 
93  inline
95  { }
96 
98  inline
100  : base_type(other)
101  { }
102 
104  inline bool
106  { return base_type::m_p_e == other.m_p_e; }
107 
109  inline bool
111  { return base_type::m_p_e != other.m_p_e; }
112 
115  {
116  _GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != 0);
117  inc();
118  return *this;
119  }
120 
123  {
124  binary_heap_const_iterator_ ret_it(base_type::m_p_e);
125  operator++();
126  return ret_it;
127  }
128 
129  private:
130  void
131  inc()
132  { ++base_type::m_p_e; }
133  };
134 
135 #undef PB_DS_BIN_HEAP_CIT_BASE
136  } // namespace detail
137 } // namespace __gnu_pbds
138 
139 #endif
binary_heap_const_iterator_()
Default constructor.
Definition: const_iterator.hpp:94
base_type::entry_pointer entry_pointer
Definition: const_iterator.hpp:64
base_type::const_pointer const_pointer
Iterator's const pointer type.
Definition: const_iterator.hpp:80
bool operator==(const binary_heap_const_iterator_ &other) const
Compares content to a different iterator object.
Definition: const_iterator.hpp:105
void inc()
Definition: const_iterator.hpp:131
#define _GLIBCXX_DEBUG_ASSERT(_Condition)
Definition: debug.h:61
binary_heap_const_iterator_(entry_pointer p_e)
Definition: const_iterator.hpp:89
base_type::value_type value_type
Iterator's value type.
Definition: const_iterator.hpp:74
Const point-type iterator.
Definition: const_iterator.hpp:60
#define PB_DS_BIN_HEAP_CIT_BASE
Definition: const_iterator.hpp:52
bool operator!=(const binary_heap_const_iterator_ &other) const
Compares content (negatively) to a different iterator object.
Definition: const_iterator.hpp:110
std::forward_iterator_tag iterator_category
Category.
Definition: const_iterator.hpp:68
PB_DS_BIN_HEAP_CIT_BASE base_type
Definition: const_iterator.hpp:63
binary_heap_const_iterator_ & operator++()
Definition: const_iterator.hpp:114
binary_heap_const_iterator_(const binary_heap_const_iterator_ &other)
Copy constructor.
Definition: const_iterator.hpp:99
base_type::pointer pointer
Iterator's pointer type.
Definition: const_iterator.hpp:77
_Alloc::difference_type difference_type
Difference type.
Definition: const_iterator.hpp:71
base_type::const_reference const_reference
Iterator's const reference type.
Definition: const_iterator.hpp:86
base_type::reference reference
Iterator's reference type.
Definition: const_iterator.hpp:83
binary_heap_const_iterator_ operator++(int)
Definition: const_iterator.hpp:122