VPTissue Reference Manual
ConstCircularIterator.h
Go to the documentation of this file.
1 #ifndef CONTAINER_CONST_CIRCULAR_ITERATOR_H_
2 #define CONTAINER_CONST_CIRCULAR_ITERATOR_H_
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "CircularIteratorImpl.h"
23 
24 #include <iterator>
25 #include <type_traits>
26 
27 namespace SimPT_Sim {
28 namespace Container {
29 
34  template<typename T>
36  typename std::add_const<typename T::value_type>::type,
37  typename std::add_const<typename T::value_type>::type*,
38  typename std::add_const<typename T::value_type>::type&>;
39 
46 template<typename T>
48 {
49  return ConstCircularIterator<typename T::const_iterator>(std::begin(c), std::end(c), std::begin(c));
50 }
51 
58 template<typename T>
60 {
61  return ConstCircularIterator<typename T::const_iterator>(std::begin(c), std::end(c), i);
62 }
63 
71 template<typename T>
73 {
74  return ConstCircularIterator<T>(b, e, i);
75 }
76 
83 template<typename T>
85 {
86  return ConstCircularIterator<T>(b, e, b);
87 }
88 
95 template<typename T>
97 {
99  return ++tmp;
100 }
101 
108 template<typename T>
110 {
112  return --tmp;
113 }
114 
115 } // namespace
116 } // namespace
117 
118 #endif // end-of-include-guard
Implementation of a circular iterator.
Impl_::CircularIterator< T, typename std::add_const< typename T::value_type >::type, typename std::add_const< typename T::value_type >::type *, typename std::add_const< typename T::value_type >::type & > ConstCircularIterator
Alias template defines const circular iterator.
Namespace for the core simulator.
Circular iterator implementation.
CircularIterator< T > next(CircularIterator< T > i)
Helper yields the position the iterator would have if moved forward (in circular fashion) by 1 positi...
ConstCircularIterator< typename T::const_iterator > make_const_circular(const T &c)
Helper produces const circular iterator whose range corresponds to the begin and end iterators of a c...
Impl_::CircularIterator< T, typename T::value_type > CircularIterator
Alias template defines non-const circular iterator.
CircularIterator< T > prev(CircularIterator< T > i)
Helper yields the position the iterator would have if moved backward (in circular fashion) by 1 posit...