#ifndef FUNCTION_INPUT_ITERATOR2_HPP #define FUNCTION_INPUT_ITERATOR2_HPP #include "eof_iterator.hpp" #include template class function_input_iterator2 : public boost::eof_iterator< function_input_iterator2, typename boost::remove_reference::type::result_type, boost::single_pass_traversal_tag > { public: function_input_iterator2(FUNC f = FUNC(), int count = 0) : f(f), count(count) { get(); } void get() { if (count == 0) { found_eof(); } else { --count; value() = f(); } } private: FUNC f; int count; }; template function_input_iterator2 make_function_input_iterator2(FUNC f, int count = 0) { return function_input_iterator2(f, count); } #endif