1 // (C) Copyright Jeremy Siek 2001. Permission to copy, use, modify,
2 // sell and distribute this software is granted provided this
3 // copyright notice appears in all copies. This software is provided
4 // "as is" without express or implied warranty, and with no claim as
5 // to its suitability for any purpose.
9 // 27 Feb 2001 Jeremy Siek
12 #ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
13 #define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
19 template <class UnaryFunction>
20 class function_output_iterator {
21 typedef function_output_iterator self;
23 typedef std::output_iterator_tag iterator_category;
24 typedef void value_type;
25 typedef void difference_type;
27 typedef void reference;
29 explicit function_output_iterator(const UnaryFunction& f = UnaryFunction())
33 output_proxy(UnaryFunction& f) : m_f(f) { }
34 template <class T> output_proxy& operator=(const T& value) {
40 output_proxy operator*() { return output_proxy(m_f); }
41 self& operator++() { return *this; }
42 self& operator++(int) { return *this; }
47 template <class UnaryFunction>
48 inline function_output_iterator<UnaryFunction>
49 make_function_output_iterator(const UnaryFunction& f = UnaryFunction()) {
50 return function_output_iterator<UnaryFunction>(f);
55 #endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP