
Hi Nate, Nathan Ridge wrote:
I get errors related to lambdas not being default-constructible or copy-assignable when using a lambda as a predicate with certain adaptors (e.g. filtered) and certain algorithms (e.g. min_element).
The following code illustrates the problem:
#include
#include int main() { int a[] = {1, 2, 3}; auto is_odd = [](int i){ return i % 2 == 1; }; boost::min_element(a | boost::adaptors::filtered(is_odd)); } The errors are shown below.
Is there a workaround for this?
I don't have any workarounds :-( but I'd like to make a comment. I think filter_iterator and transform_iterator should use boost::optional to cope with this kind of problems. For transform_iterator, there's a trac ticket https://svn.boost.org/trac/boost/ticket/4189 Unfortunately there is no reaction on this ticket. Regards, Michel