yat  0.13.2pre
DataIterator.h
1 #ifndef _theplu_yat_utility_data_iterator_
2 #define _theplu_yat_utility_data_iterator_
3 
4 // $Id: DataIterator.h 3417 2015-05-25 01:35:59Z peter $
5 
6 /*
7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009, 2010, 2014, 2015 Peter Johansson
9 
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11 
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16 
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24 */
25 
26 #include "iterator_traits.h"
27 
28 #include <boost/concept_check.hpp>
29 #include <boost/iterator/iterator_adaptor.hpp>
30 #include <boost/type_traits/remove_reference.hpp>
31 
32 namespace theplu {
33 namespace yat {
34 namespace utility {
35 
61  template<typename Base>
63  : public boost::iterator_adaptor<
64  DataIterator<Base> // Derived
65  , Base // Base
66  , typename boost::remove_reference<typename iterator_traits<Base>::data_reference>::type
67  , boost::use_default // CategoryOrTraversal
68  , typename iterator_traits<Base>::data_reference // Reference
69  >
70 
71  {
72  public:
76  explicit DataIterator(Base b)
77  : DataIterator::iterator_adaptor_(b)
78  {
79  BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>));
80  }
81 
88  : DataIterator::iterator_adaptor_()
89  {
90  BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>));
91  }
92 
100  template<typename B2>
102  typename boost::enable_if_convertible<B2, Base>::type* = 0 )
103  : DataIterator::iterator_adaptor_(other.base()) {}
104 
111  { return iterator_traits<Base>().data(this->base()); }
112 
113  private:
114  };
115 
123  template<typename Base>
125  {
126  return DataIterator<Base>(base);
127  }
128 
129 
130 }}} // of namespace utility, yat, and theplu
131 
132 #endif
DataIterator(DataIterator< B2 > other, typename boost::enable_if_convertible< B2, Base >::type *=0)
Conversion constructor.
Definition: DataIterator.h:101
Definition: iterator_traits.h:412
iterator_traits< Base >::data_reference operator*(void) const
Definition: DataIterator.h:110
DataIterator.
Definition: DataIterator.h:62
DataIterator(void)
Default Constructor.
Definition: DataIterator.h:87
traits::data_reference data_reference
Definition: iterator_traits.h:425
DataIterator(Base b)
Constructor from Base iterator.
Definition: DataIterator.h:76
DataIterator< Base > data_iterator(Base base)
convenient function to create DataIterator
Definition: DataIterator.h:124

Generated on Wed Jan 4 2017 02:23:07 for yat by  doxygen 1.8.5