Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
ConstCircularIterator.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This file is part of the gobelijn software.
4  * Gobelijn is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation, either version 3 of the License, or any later
7  * version. Gobelijn is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9  * or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for details. You should have received
11  * a copy of the GNU General Public License along with the software. If not,
12  * see <http://www.gnu.org/licenses/>.
13  *
14  * Copyright 2012, Jan Broeckhove, CoMP research group, Universiteit Antwerpen.
15  */
21 #include <iterator>
22 #include <type_traits>
23 
24 #include "CircularIteratorImpl.h"
25 
26 namespace UA_CoMP {
27 namespace Container {
28 
33 template <typename T>
34 using ConstCircularIterator = Impl_::CircularIterator<T, typename std::add_const<typename T::value_type>::type,
35  typename std::add_const<typename T::value_type>::type*,
36  typename std::add_const<typename T::value_type>::type&>;
37 
44 template <typename T>
46 {
47  return ConstCircularIterator<typename T::const_iterator>(std::begin(c), std::end(c), std::begin(c));
48 }
49 
56 template <typename T>
58 {
59  return ConstCircularIterator<typename T::const_iterator>(std::begin(c), std::end(c), i);
60 }
61 
69 template <typename T>
71 {
72  return ConstCircularIterator<T>(b, e, i);
73 }
74 
81 template <typename T>
83 {
84  return ConstCircularIterator<T>(b, e, b);
85 }
86 
93 template <typename T>
95 {
97  return ++tmp;
98 }
99 
106 template <typename T>
108 {
110  return --tmp;
111 }
112 } // namespace Container
113 } // namespace UA_CoMP
CircularIterator< T > prev(CircularIterator< T > i)
Helper yields the position the iterator would have if moved backward (in circular fashion) by 1 posit...
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...
Implementation of a circular iterator.
Circular iterator implementation.
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.
CircularIterator< T > next(CircularIterator< T > i)
Helper yields the position the iterator would have if moved forward (in circular fashion) by 1 positi...