00001 /* iterator_to_const and const_iterator_to_const class declarations. 00002 Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> 00003 Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) 00004 00005 This file is part of the Parma Polyhedra Library (PPL). 00006 00007 The PPL is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by the 00009 Free Software Foundation; either version 3 of the License, or (at your 00010 option) any later version. 00011 00012 The PPL is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software Foundation, 00019 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 00020 00021 For the most up-to-date information see the Parma Polyhedra Library 00022 site: http://www.cs.unipr.it/ppl/ . */ 00023 00024 #ifndef PPL_iterator_to_const_hh 00025 #define PPL_iterator_to_const_hh 1 00026 00027 #include "iterator_to_const.types.hh" 00028 #include "Powerset.types.hh" 00029 //#include "Ask_Tell.types.hh" 00030 #include <iterator> 00031 00032 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00033 00034 00049 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 00050 template <typename Container> 00051 class Parma_Polyhedra_Library::iterator_to_const { 00052 private: 00054 typedef typename Container::iterator Base; 00055 00057 typedef typename 00058 std::iterator_traits<typename Container::const_iterator> Traits; 00059 00061 Base base; 00062 00064 iterator_to_const(const Base& b); 00065 00066 friend class const_iterator_to_const<Container>; 00067 template <typename T> friend class Powerset; 00068 //template <typename T> friend class Ask_Tell; 00069 00070 public: 00071 // Same traits of the const_iterator, therefore 00072 // forbidding the direct modification of sequence elements. 00073 typedef typename Traits::iterator_category iterator_category; 00074 typedef typename Traits::value_type value_type; 00075 typedef typename Traits::difference_type difference_type; 00076 typedef typename Traits::pointer pointer; 00077 typedef typename Traits::reference reference; 00078 00080 iterator_to_const(); 00081 00083 iterator_to_const(const iterator_to_const& y); 00084 00086 reference operator*() const; 00087 00089 pointer operator->() const; 00090 00092 iterator_to_const& operator++(); 00093 00095 iterator_to_const operator++(int); 00096 00098 iterator_to_const& operator--(); 00099 00101 iterator_to_const operator--(int); 00102 00107 bool operator==(const iterator_to_const& y) const; 00108 00113 bool operator!=(const iterator_to_const& y) const; 00114 }; 00115 00116 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00117 00118 00123 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 00124 template <typename Container> 00125 class Parma_Polyhedra_Library::const_iterator_to_const { 00126 private: 00128 typedef typename Container::const_iterator Base; 00129 00131 typedef typename std::iterator_traits<Base> Traits; 00132 00134 Base base; 00135 00137 const_iterator_to_const(const Base& b); 00138 00139 friend class iterator_to_const<Container>; 00140 template <typename T> friend class Powerset; 00141 //template <typename T> friend class Ask_Tell; 00142 00143 public: 00144 // Same traits of the underlying const_iterator. 00145 typedef typename Traits::iterator_category iterator_category; 00146 typedef typename Traits::value_type value_type; 00147 typedef typename Traits::difference_type difference_type; 00148 typedef typename Traits::pointer pointer; 00149 typedef typename Traits::reference reference; 00150 00152 const_iterator_to_const(); 00153 00155 const_iterator_to_const(const const_iterator_to_const& y); 00156 00158 const_iterator_to_const(const iterator_to_const<Container>& y); 00159 00161 reference operator*() const; 00162 00164 pointer operator->() const; 00165 00167 const_iterator_to_const& operator++(); 00168 00170 const_iterator_to_const operator++(int); 00171 00173 const_iterator_to_const& operator--(); 00174 00176 const_iterator_to_const operator--(int); 00177 00182 bool operator==(const const_iterator_to_const& y) const; 00183 00188 bool operator!=(const const_iterator_to_const& y) const; 00189 }; 00190 00191 namespace Parma_Polyhedra_Library { 00192 00193 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00194 00200 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 00201 template <typename Container> 00202 bool 00203 operator==(const iterator_to_const<Container>& x, 00204 const const_iterator_to_const<Container>& y); 00205 00206 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00207 00213 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 00214 template <typename Container> 00215 bool 00216 operator!=(const iterator_to_const<Container>& x, 00217 const const_iterator_to_const<Container>& y); 00218 00219 } // namespace Parma_Polyhedra_Library 00220 00221 #include "iterator_to_const.inlines.hh" 00222 00223 #endif // !defined(PPL_iterator_to_const_hh)
1.6.3