1 // (C) Copyright Jeremy Siek 2001.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
8 // 27 Feb 2001 Jeremy Siek
11 #ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
12 #define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
18 template <class UnaryFunction>
19 class function_output_iterator {
20 typedef function_output_iterator self;
22 typedef std::output_iterator_tag iterator_category;
23 typedef void value_type;
24 typedef void difference_type;
26 typedef void reference;
28 explicit function_output_iterator() {}
30 explicit function_output_iterator(const UnaryFunction& f)
34 output_proxy(UnaryFunction& f) : m_f(f) { }
35 template <class T> output_proxy& operator=(const T& value) {
41 output_proxy operator*() { return output_proxy(m_f); }
42 self& operator++() { return *this; }
43 self& operator++(int) { return *this; }
48 template <class UnaryFunction>
49 inline function_output_iterator<UnaryFunction>
50 make_function_output_iterator(const UnaryFunction& f = UnaryFunction()) {
51 return function_output_iterator<UnaryFunction>(f);
56 #endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP