On Sunday, February 14, 2016 at 6:28:47 PM UTC-6, Mikhail Matrosov wrote:
Consider the following code snippet:
auto f = [](int x) { std::cout << x; };auto it = boost::make_function_output_iterator(f);decltype(it) it2 = it; // Ok, copied it2 = it; // Does not compile, cannot assign!
The problem is, function_output_iterator constructed in this way is not assignable, and thus does not satisfy the Iterator http://en.cppreference.com/w/cpp/concept/Iterator concept, which requires type to be CopyAssignable http://en.cppreference.com/w/cpp/concept/CopyAssignable.
One way to deal with this is to put it into boost::optional. However, it now
needs to be dereferenced. This can be easily done with `fit::indirect`:
template<class F>
fit::indirect_adaptor