16 #ifndef TURI_FUNCTION_OUTPUT_ITERATOR_HPP 17 #define TURI_FUNCTION_OUTPUT_ITERATOR_HPP 28 template <
class UnaryFunction,
class MoveFunction>
32 typedef std::output_iterator_tag iterator_category;
33 typedef void value_type;
34 typedef void difference_type;
36 typedef void reference;
38 explicit function_output_iterator() {}
40 explicit function_output_iterator(
const UnaryFunction& f,
const MoveFunction& f2)
44 output_proxy(UnaryFunction& f, MoveFunction& f2) : m_f(f), m_f2(f2) { }
45 template <
class T> output_proxy& operator=(
const T& value) {
52 void output_forward(T&& value, std::integral_constant<bool, true>) {
54 m_f2(std::move(value));
58 void output_forward(T&& value, std::integral_constant<bool, false>) {
63 template <
class T> output_proxy& operator=(T&& value) {
67 output_forward(std::forward<T>(value),
68 typename std::is_rvalue_reference<decltype(std::forward<T>(value))>::type());
72 template <
class T> output_proxy& operator=(
const T&& value) {
75 output_forward(value, std::integral_constant<bool, false>());
83 output_proxy operator*() {
return output_proxy(m_f, m_f2); }
84 self& operator++() {
return *
this; }
85 self& operator++(
int) {
return *
this; }
92 #endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP