STIR  6.2.0
FullArrayIterator.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000 PARAPET partners
3  Copyright (C) 2000-2011, Hammersmith Imanet Ltd
4  This file is part of STIR.
5 
6  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
7 
8  See STIR/LICENSE.txt for details
9 */
10 #ifndef __stir_FullArrayIterator__H__
11 #define __stir_FullArrayIterator__H__
12 
23 #include "stir/common.h"
24 #include <iterator>
25 #include "boost/iterator/iterator_adaptor.hpp"
26 
27 START_NAMESPACE_STIR
28 
47 template <typename topleveliterT, typename restiterT, typename elemT, typename _Ref, typename _Ptr>
48 class FullArrayIterator
49 {
50 public:
51  typedef std::forward_iterator_tag iterator_category;
52  typedef std::ptrdiff_t difference_type;
53 
54  typedef elemT value_type;
55  typedef _Ref reference;
56  typedef _Ptr pointer;
57 
58 public:
60  inline FullArrayIterator();
61 
63  inline FullArrayIterator(const FullArrayIterator&);
64 
66  inline FullArrayIterator(const topleveliterT& top_level_iter,
67  const topleveliterT& last_top_level_iter,
68  const restiterT& rest_iter,
69  const restiterT& last_rest_iter);
70 
72 
75  template <typename othertopleveliterT, typename otherrestiterT, typename _otherRef, typename _otherPtr>
77  typename boost::enable_if_convertible<othertopleveliterT, topleveliterT>::type* = 0,
78  typename boost::enable_if_convertible<otherrestiterT, restiterT>::type* = 0)
79  : current_top_level_iter(other.current_top_level_iter),
80  last_top_level_iter(other.last_top_level_iter),
81  current_rest_iter(other.current_rest_iter),
82  last_rest_iter(other.last_rest_iter)
83  {}
84 
86 
98  inline FullArrayIterator(unsigned);
99 
100  // assignment is generated by compiler
101  // inline FullArrayIterator& operator=(const FullArrayIterator&);
102 
104  inline FullArrayIterator& operator++();
105 
107  inline FullArrayIterator operator++(int);
108 
110  inline bool operator==(const FullArrayIterator&) const;
111  inline bool operator!=(const FullArrayIterator&) const;
112 
114  inline reference operator*() const;
115 
117  inline pointer operator->() const;
118 
119 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
120 public:
121 #else
122 private:
123  // needed for conversion constructor
124  template <class, class, class, class, class>
125  friend class FullArrayIterator;
126 #endif
127 
129  topleveliterT current_top_level_iter;
130 
132  topleveliterT last_top_level_iter;
133 
135  restiterT current_rest_iter;
136 
138  restiterT last_rest_iter;
139 };
140 
141 END_NAMESPACE_STIR
142 
144 
145 #endif
Class FullArrayIterator implements (forward) iterators that go through all elements of an Array...
Definition: Array.h:46
FullArrayIterator(FullArrayIterator< othertopleveliterT, otherrestiterT, elemT, _otherRef, _otherPtr > const &other, typename boost::enable_if_convertible< othertopleveliterT, topleveliterT >::type *=0, typename boost::enable_if_convertible< otherrestiterT, restiterT >::type *=0)
some magic trickery to be able to assign iterators to const iterators etc, but not to incompatible ty...
Definition: FullArrayIterator.h:76
inline implementations for stir::FullArrayIterator.
basic configuration include file