I want to use a transform_iterator to make a delta transformation on a range. By delta transformation I mean that r0 should stay the same and the subsequent elements, ri, are mapped to (ri - ri - 1).
My problem is that as far as I can tell a transform_iterator needs a const functor, but my functor needs to remember the previous value. How can I solve this? Should I just write my own iterator?
The reason I want it as an iterator is that in the next step I want to make a range adaptor from it.
EDIT: It seems transform_iterator does allow non-const functors and that it was really my range adaptor that complained about the lack of constness. I'll keep the question open since the discussion about how appropriate it is to use transform_iterator anyway seems interesting.