The boost function make_function_output_iterator converts a function that would be appropriate for std::for_each into an iterator appropriate for std::copy. Is there a boost function that does the reverse. That is, takes an iterator appropriate for std::copy and converts it to a function appropriate for std::for_each.
So if I have an output iterator output_iter. I need
for_each(v1.begin(), v1.end(), make_output_iterator_function(output_iter));
To do the same thing as
copy(v1.begin(), v1.end(), output_iter);
Maybe
std::insert_iteratororstd::transformare what you are looking for?You can bind
std::insert_iterator::operator=, which does an insert on every invocation, with someboost::bindsorcery: