- Timestamp:
- Jul 10, 2008, 10:30:07 PM (15 years ago)
- Location:
- trunk/yat/utility
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/DataIterator.h
r1363 r1365 1 #ifndef _theplu_yat_utility_ iterator_data_2 #define _theplu_yat_utility_ iterator_data_1 #ifndef _theplu_yat_utility_data_iterator_ 2 #define _theplu_yat_utility_data_iterator_ 3 3 4 4 // $Id$ … … 25 25 */ 26 26 27 #include "yat_assert.h"27 #include <boost/iterator/iterator_adaptor.hpp> 28 28 29 29 namespace theplu { … … 32 32 33 33 /** 34 @brief Iterator34 @brief DataIterator 35 35 */ 36 template<typename T> 37 class IteratorData 36 template<typename Base> 37 class DataIterator 38 : public boost::iterator_adaptor< 39 DataIterator<Base> // Derived 40 , Base // Base 41 , double // Value 42 , boost::forward_traversal_tag // CategoryOrTraversal 43 , double 44 > 45 38 46 { 39 47 public: 40 IteratorData(T); 48 explicit DataIterator(Base b) 49 : DataIterator::iterator_adaptor_(b) {} 50 51 double operator*(void) const 52 { return iterator_traits<Base>().data(this->base()); } 41 53 42 54 private: 43 T base_;44 55 }; 45 56 46 template<typename T> 47 IteratorData<T>::IteratorData(T base) 48 : base_(base) 49 {} 57 /** 58 \brief convenient function to create DataIterator 59 60 Convenient function in same fashion as std::make_pair. 61 */ 62 template<typename Base> 63 DataIterator<Base> make_data_iterator(Base base) 64 { 65 return DataIterator<Base>(base); 66 } 67 50 68 51 69 -
trunk/yat/utility/Makefile.am
r1364 r1365 38 38 include_utility_HEADERS = \ 39 39 Alignment.h ColumnStream.h CommandLine.h \ 40 Container2DIterator.h \41 Exception.h FileUtil.h Index.h IteratorData.h\40 Container2DIterator.h DataIterator.h \ 41 Exception.h FileUtil.h Index.h \ 42 42 IteratorPolicy.h iterator_traits.h \ 43 43 kNNI.h Matrix.h NNI.h \ -
trunk/yat/utility/iterator_traits.h
r1275 r1365 135 135 This class must be implemented for every iterator that can be weighted. 136 136 137 \see StrideIterator and Iterator137 \see StrideIterator and Container2DIterator 138 138 */ 139 139 template <class Iter>
Note: See TracChangeset
for help on using the changeset viewer.