Util--  1.1
iter.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * $Id: iter.hh 957 2005-03-07 16:01:20Z sjoyeux $
3  */
4 #ifndef UTILMM_UTILS_HASH_ITER_HEADER
5 # define UTILMM_UTILS_HASH_ITER_HEADER
6 
8 
9 namespace utilmm {
20  namespace hash_toolbox {
21 
22  template< typename Key, typename Value, class Extract,
23  class Hash, class Equal >
24  class iter;
25 
36  template< typename Key, typename Value, class Extract,
37  class Hash, class Equal >
38  class const_iter {
39  public:
44  typedef Value value_type;
50  typedef value_type const *pointer;
56  typedef value_type const &reference;
62  typedef size_t size_type;
63 
68  const_iter();
77 
85  bool operator==(const_iter const &other) const;
93  bool operator!=(const_iter const &other) const;
94 
104  const_iter &operator+=(size_type delta);
114  const_iter operator+ (size_type delta) const;
115 
129  const_iter operator++(int);
130 
138  pointer operator->() const;
143  reference operator* () const;
144 
145  private:
147  typedef typename container_type::node_type node_type;
148 
149  container_type const *owner;
150  node_type const *current;
151 
152  const_iter(node_type const *, container_type const *);
153 
154  template<typename K, typename V, class Ex, class H, class Eq>
155  friend class table;
156  }; // class utilmm::hash_toolbox::const_iter<>
157 
158  template<typename K, typename V, class Ex, class H, class Eq>
159  const_iter<K, V, Ex, H, Eq> operator+
161  const_iter<K, V, Ex, H, Eq> const &i) {
162  return i+d;
163  }
164 
173  template< typename Key, typename Value, class Extract,
174  class Hash, class Equal >
175  class iter {
176  public:
181  typedef Value value_type;
187  typedef value_type *pointer;
192  typedef value_type &reference;
198  typedef size_t size_type;
199 
204  iter();
205 
213  bool operator==(iter const &other) const;
221  bool operator!=(iter const &other) const;
222 
232  iter &operator+=(size_type pos);
242  iter operator+ (size_type pos) const;
243 
250  iter &operator++();
257  iter operator++(int);
258 
266  pointer operator->() const;
271  reference operator* () const;
272 
273  private:
275  typedef typename container_type::node_type node_type;
276 
277  container_type *owner;
278  node_type *current;
279 
280  iter(node_type *, container_type *);
281 
282  template<typename K, typename V, class Ex, class H, class Eq>
283  friend class const_iter;
284 
285  template<typename K, typename V, class Ex, class H, class Eq>
286  friend class table;
287  }; // class utilmm::hash_toolbox::iter<>
288 
289  template<typename K, typename V, class Ex, class H, class Eq>
290  iter<K, V, Ex, H, Eq> operator+
292  iter<K, V, Ex, H, Eq> const &i) {
293  return i+d;
294  }
295 
296  } // namespace utilmm::hash_toolbox
297 } // namespace utilmm
298 
299 # define IN_UTILMM_UTILS_HASH_ITER_HEADER
300 # include "utilmm/hash/bits/iter.tcc"
301 # undef IN_UTILMM_UTILS_HASH_ITER_HEADER
302 #endif // UTILMM_UTILS_HASH_ITER_HEADER
303 
pointer operator->() const
access operator
Hashing based table.
Definition: table.hh:46
value_type * pointer
Pointer type.
Definition: iter.hh:187
Value value_type
Type of the pointed elements.
Definition: iter.hh:44
const_iter & operator+=(size_type delta)
Advance operation.
bool operator==(const_iter const &other) const
Equality test.
bool operator!=(const_iter const &other) const
Difference test.
Value value_type
Type of the pointed elements.
Definition: iter.hh:181
reference operator*() const
dereference operator
value_type const * pointer
Pointer type.
Definition: iter.hh:50
Definition: table.hh:19
const_iter & operator++()
Pre-incremant operation.
const_iter operator+(size_type delta) const
Addition operation.
value_type & reference
Reference type.
Definition: iter.hh:192
Definition: auto_flag.hh:6
forward declaration of utilmm::hash_toolbox::table
iterator for table
Definition: iter.hh:24
const iterator for table
Definition: iter.hh:38
const_iter()
default crontructor
size_t size_type
Size type.
Definition: iter.hh:198
value_type const & reference
Reference type.
Definition: iter.hh:56
size_t size_type
Size type.
Definition: iter.hh:62

Generated on Mon Sep 24 2018 17:06:40 for Util-- by doxygen 1.8.13
SourceForge.net Project Page