PPL  1.2
Ptr_Iterator_defs.hh
Go to the documentation of this file.
1 /* Ptr_Iterator class declaration.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Ptr_Iterator_defs_hh
25 #define PPL_Ptr_Iterator_defs_hh 1
26 
27 #include "Ptr_Iterator_types.hh"
28 #include <iterator>
29 
30 namespace Parma_Polyhedra_Library {
31 
32 namespace Implementation {
33 
34 template<typename P, typename Q>
35 bool operator==(const Ptr_Iterator<P>& x, const Ptr_Iterator<Q>& y);
36 
37 template<typename P, typename Q>
38 bool operator!=(const Ptr_Iterator<P>& x, const Ptr_Iterator<Q>& y);
39 
40 template<typename P, typename Q>
41 bool operator<(const Ptr_Iterator<P>& x, const Ptr_Iterator<Q>& y);
42 
43 template<typename P, typename Q>
44 bool operator<=(const Ptr_Iterator<P>& x, const Ptr_Iterator<Q>& y);
45 
46 template<typename P, typename Q>
47 bool operator>(const Ptr_Iterator<P>& x, const Ptr_Iterator<Q>& y);
48 
49 template<typename P, typename Q>
50 bool operator>=(const Ptr_Iterator<P>& x, const Ptr_Iterator<Q>& y);
51 
52 template<typename P, typename Q>
53 typename Ptr_Iterator<P>::difference_type
54 operator-(const Ptr_Iterator<P>& x, const Ptr_Iterator<Q>& y);
55 
56 template<typename P>
57 Ptr_Iterator<P> operator+(typename Ptr_Iterator<P>::difference_type m,
58  const Ptr_Iterator<P>& y);
59 
60 } // namespace Implementation
61 
62 } // namespace Parma_Polyhedra_Library
63 
64 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
65 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
67 template <typename P>
69  : public std::iterator<typename std::iterator_traits<P>::iterator_category,
70  typename std::iterator_traits<P>::value_type,
71  typename std::iterator_traits<P>::difference_type,
72  typename std::iterator_traits<P>::pointer,
73  typename std::iterator_traits<P>::reference> {
74 public:
75  typedef typename std::iterator_traits<P>::difference_type difference_type;
76  typedef typename std::iterator_traits<P>::reference reference;
77  typedef typename std::iterator_traits<P>::pointer pointer;
78 
80  Ptr_Iterator();
81 
83  explicit Ptr_Iterator(const P& q);
84 
89  template<typename Q>
90  Ptr_Iterator(const Ptr_Iterator<Q>& q);
91 
93  reference operator*() const;
94 
96  pointer operator->() const;
97 
99  reference operator[](const difference_type m) const;
100 
103 
106 
109 
112 
114  Ptr_Iterator& operator+=(const difference_type m);
115 
117  Ptr_Iterator& operator-=(const difference_type m);
118 
120  difference_type operator-(const Ptr_Iterator& y) const;
121 
123  Ptr_Iterator operator+(const difference_type m) const;
124 
126  Ptr_Iterator operator-(const difference_type m) const;
127 
128 private:
130  P p;
131 
133  const P& base() const;
134 
135  template <typename Q, typename R>
137  operator==(const Ptr_Iterator<Q>& x, const Ptr_Iterator<R>& y);
138 
139  template <typename Q, typename R>
141  operator!=(const Ptr_Iterator<Q>& x, const Ptr_Iterator<R>& y);
142 
143  template<typename Q, typename R>
144  friend bool Parma_Polyhedra_Library::Implementation::
145  operator<(const Ptr_Iterator<Q>& x, const Ptr_Iterator<R>& y);
146 
147  template<typename Q, typename R>
148  friend bool Parma_Polyhedra_Library::Implementation::
149  operator<=(const Ptr_Iterator<Q>& x, const Ptr_Iterator<R>& y);
150 
151  template<typename Q, typename R>
153  operator>(const Ptr_Iterator<Q>& x, const Ptr_Iterator<R>& y);
154 
155  template<typename Q, typename R>
157  operator>=(const Ptr_Iterator<Q>& x, const Ptr_Iterator<R>& y);
158 
159  template<typename Q, typename R>
160  friend typename Ptr_Iterator<Q>::difference_type
162  operator-(const Ptr_Iterator<Q>& x, const Ptr_Iterator<R>& y);
163 
164  friend Ptr_Iterator<P>
165  Parma_Polyhedra_Library::Implementation::
166  operator+<>(typename Ptr_Iterator<P>::difference_type m,
167  const Ptr_Iterator<P>& y);
168 };
169 
170 #include "Ptr_Iterator_inlines.hh"
171 
172 #endif // !defined(PPL_Ptr_Iterator_defs_hh)
pointer operator->() const
Indirect member selector.
Ptr_Iterator< P >::difference_type operator-(const Ptr_Iterator< P > &x, const Ptr_Iterator< Q > &y)
bool operator>(const Ptr_Iterator< P > &x, const Ptr_Iterator< Q > &y)
reference operator[](const difference_type m) const
Subscript operator.
Ptr_Iterator & operator--()
Prefix decrement operator.
A class to define STL const and non-const iterators from pointer types.
bool operator>=(const Ptr_Iterator< P > &x, const Ptr_Iterator< Q > &y)
Ptr_Iterator()
Default constructor: no guarantees.
difference_type operator-(const Ptr_Iterator &y) const
Returns the difference between *this and y.
std::iterator_traits< P >::reference reference
reference operator*() const
Dereference operator.
P p
The base pointer implementing the iterator.
bool operator==(const EList_Iterator< T > &x, const EList_Iterator< T > &y)
Returns true if and only if x and y are equal.
bool operator!=(const EList_Iterator< T > &x, const EList_Iterator< T > &y)
Returns true if and only if x and y are different.
Ptr_Iterator & operator++()
Prefix increment operator.
Ptr_Iterator & operator-=(const difference_type m)
Assignment-decrement operator.
Ptr_Iterator & operator+=(const difference_type m)
Assignment-increment operator.
The entire library is confined to this namespace.
Definition: version.hh:61
Ptr_Iterator operator+(const difference_type m) const
Returns the sum of *this and m.
std::iterator_traits< P >::difference_type difference_type
Ptr_Iterator< P > operator+(typename Ptr_Iterator< P >::difference_type m, const Ptr_Iterator< P > &y)
const P & base() const
Returns the hidden pointer.