Subject: Re: [boost] [algorithm] adjacent_for_each interest?
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2013-02-11 20:17:56
2013/2/11 Nathan Ridge <zeratul976_at_[hidden]>
> > > Is there any interest in a version of for_each that operates on each
> adjacent pair of elements in a range?
> > [...]
> > P.S. Consider implementation of companion - transform_adjacent.
> > Maybe even consider version which accepts "count of adjacent elements
> > within each iteration" as template non-type parameter.
> > Or maybe choose some another approach involving Boost.Range?
> I think a more general approach would be a Boost.Range-style range
> adaptor  that presents a view of the range where elements in
> the view are pairs of (references to, if desired) elements in the
> underlying range. You can then use standard algorithms like for_each
> and transform on the adapted range.
> I have written such an adaptor in the past and called it
> 'adjacent_paired'. I've also seen (can't remember where) the name
> 'windowed' used for the more general version which presents a view
> of tuples of N adjacent elements.
I have range-adaptor implementation already.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk