File indexing completed on 2025-01-18 09:51:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_ITERATOR_MIXIN_HPP
0014 #define BOOST_ITERATOR_MIXIN_HPP
0015
0016 #include <boost/operators.hpp>
0017
0018 namespace boost {
0019
0020
0021 template<class Generator, class ResultType>
0022 class generator_iterator_mixin_adapter
0023 : incrementable<Generator>, equality_comparable<Generator>
0024 {
0025 public:
0026 typedef std::input_iterator_tag iterator_category;
0027 typedef ResultType value_type;
0028 typedef std::ptrdiff_t difference_type;
0029 typedef const value_type * pointer;
0030 typedef const value_type & reference;
0031 Generator& operator++() { v = cast()(); return cast(); }
0032 const value_type& operator*() const { return v; }
0033
0034 protected:
0035
0036 generator_iterator_mixin_adapter() { }
0037 void iterator_init() { operator++(); }
0038 private:
0039 Generator & cast() { return static_cast<Generator&>(*this); }
0040 value_type v;
0041 };
0042
0043 }
0044
0045 #endif