On 9/22/2013 6:37 AM, Quoth Giorgos Sermaidis:
struct to_include { bool operator()(const std::pair
& x) { return x.first; } }; [...] /* reverse and then filter */ auto rf = container_cpy | reversed | filtered(to_include()); auto rf_it1 = rf.begin(); auto rf_it2 = std::next(rf_it1); rf_it2->first = false;
This is just a guess, but it strikes me as potentially dodgy to retain iterators to a filtered sequence after modifying the result of the filter predicate on that sequence. (This seems like something that would invalidate iterators, just like certain collection modifications do.) Have you tried re-acquiring the iterators from "rf" or "fr" after assigning to "first", rather than continuing to use them? (You shouldn't need to reconstruct "rf" or "fr" themselves, just the iterators.)