|
Boost : |
Subject: Re: [boost] Formal Review: Boost.RangeEx
From: Rogier van Dalen (rogiervd_at_[hidden])
Date: 2009-02-26 08:05:04
On Thu, 2009-02-26 at 13:33 +0100, Mathias Gaunard wrote:
> Neil Groves wrote:
>
> > So is everyone happy if I:
> > 1. Change the 'ed' adaptors to _view
>
> I wouldn't be too happy about it.
> The lazy adaptors being preferred over the eager in-place algorithms,
That seems to be the question, which . The discussion has been about
three classes of operations:
1. operator| lazy adaptors
2. Function-style lazy adaptors
3. In-place algorithms
Is (2) preferred over (3)? Well, what would the consequences be?
Many in-place algorithms can then be written in terms of lazy adaptors.
E.g. it would be possible to write
transform (rng1, output_it, fun);
as
copy (transform_view (rng1, fun), output_it);
or
copy (rng1 | transform_view (fun), output_it);
(These can forward to fast versions where required)
It might be harder, though, to phrase e.g. "remove" lazily. It would be
good to be able to say
rng = remove (rng, 3);
to remove al elements equal to 3 from the range and reduce its length as
required, but that's hard to get to work generally and make as fast as
the original.
If that is true, it makes sense to use infinitives ("remove") for (3),
and use something else for (1) and (2). I don't find the past participle
('removed') worse than 'remove_view', just more concise.
I still suggest removing any operation that uses output iterators
(except "copy"), and just use lazy versions.
Cheers,
Rogier
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk