PPL  1.2
iterator_to_const_defs.hh
Go to the documentation of this file.
1 /* iterator_to_const and const_iterator_to_const class declarations.
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_iterator_to_const_hh
25 #define PPL_iterator_to_const_hh 1
26 
28 #include "Powerset_types.hh"
29 #include <iterator>
30 
31 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
32 
48 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
49 template <typename Container>
51 private:
53  typedef typename Container::iterator Base;
54 
56  typedef typename
57  std::iterator_traits<typename Container::const_iterator> Traits;
58 
60  Base base;
61 
63  iterator_to_const(const Base& b);
64 
65  friend class const_iterator_to_const<Container>;
66  template <typename T> friend class Powerset;
67 
68 public:
69  // Same traits of the const_iterator, therefore
70  // forbidding the direct modification of sequence elements.
71  typedef typename Traits::iterator_category iterator_category;
72  typedef typename Traits::value_type value_type;
73  typedef typename Traits::difference_type difference_type;
74  typedef typename Traits::pointer pointer;
75  typedef typename Traits::reference reference;
76 
79 
82 
84  reference operator*() const;
85 
87  pointer operator->() const;
88 
91 
94 
97 
100 
105  bool operator==(const iterator_to_const& y) const;
106 
111  bool operator!=(const iterator_to_const& y) const;
112 };
113 
114 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
115 
121 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
122 template <typename Container>
124 private:
126  typedef typename Container::const_iterator Base;
127 
129  typedef typename std::iterator_traits<Base> Traits;
130 
132  Base base;
133 
135  const_iterator_to_const(const Base& b);
136 
137  friend class iterator_to_const<Container>;
138  template <typename T> friend class Powerset;
139 
140 public:
141  // Same traits of the underlying const_iterator.
142  typedef typename Traits::iterator_category iterator_category;
143  typedef typename Traits::value_type value_type;
144  typedef typename Traits::difference_type difference_type;
145  typedef typename Traits::pointer pointer;
146  typedef typename Traits::reference reference;
147 
150 
153 
156 
158  reference operator*() const;
159 
161  pointer operator->() const;
162 
165 
168 
171 
174 
179  bool operator==(const const_iterator_to_const& y) const;
180 
185  bool operator!=(const const_iterator_to_const& y) const;
186 };
187 
188 namespace Parma_Polyhedra_Library {
189 
190 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
191 
197 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
198 template <typename Container>
199 bool
202 
203 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
204 
210 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
211 template <typename Container>
212 bool
215 
216 } // namespace Parma_Polyhedra_Library
217 
219 
220 #endif // !defined(PPL_iterator_to_const_hh)
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
Definition: Box_inlines.hh:264
pointer operator->() const
Indirect access operator.
reference operator*() const
Dereference operator.
pointer operator->() const
Indirect member selector.
bool operator==(const iterator_to_const &y) const
Returns true if and only if *this and y are identical.
Container::iterator Base
The type of the underlying mutable iterator.
bool operator==(const const_iterator_to_const &y) const
Returns true if and only if *this and y are identical.
The powerset construction on a base-level domain.
iterator_to_const & operator++()
Prefix increment operator.
const_iterator_to_const & operator++()
Prefix increment operator.
Base base
A const_iterator on the sequence of elements.
Base base
A (mutable) iterator on the sequence of elements.
A const_iterator on a sequence of read-only objects.
The entire library is confined to this namespace.
Definition: version.hh:61
bool operator!=(const iterator_to_const &y) const
Returns true if and only if *this and y are different.
std::iterator_traits< typename Container::const_iterator > Traits
A shortcut for naming the const_iterator traits.
std::iterator_traits< Base > Traits
A shortcut for naming traits.
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
An iterator on a sequence of read-only objects.
iterator_to_const & operator--()
Prefix decrement operator.
reference operator*() const
Dereference operator.
Container::const_iterator Base
The type of the underlying const_iterator.
bool operator!=(const const_iterator_to_const &y) const
Returns true if and only if *this and y are different.
const_iterator_to_const & operator--()
Prefix decrement operator.