Boost logo

Boost :

Subject: Re: [boost] Formal Review: Boost.RangeEx
From: Rogier van Dalen (rogiervd_at_[hidden])
Date: 2009-03-03 09:15:39

On Mon, 2009-03-02 at 13:14 -0500, David Abrahams wrote:
> on Mon Mar 02 2009, Rogier van Dalen <> wrote:
> > Shouldn't this go into a more general library? Shouldn't RangeEx by
> > default offer the well-known syntax of function calls?
> The only standard syntax I know for stringing together sequence
> modifications like that is "|"

Do you mean the pipe operator in shell scripts?

> > (Even though I agree that also providing operator| is sensible, and
> > not very hard at all.)
> It should be the only syntax.

We're not only discussing "stringing together sequence modifications"
though. The base case under discussion is a single operation. Implicitly
you're saying that applying a transformation to all elements should be
written as
        rng | transform (func)
rather than
        transform (rng, func)
The former is not standard syntax in C++, nor any other language
Could you give a rationale for centring your argument around chains of
operations, rather than the base case of a single operation?

> >> What we're doing with RangeEx (in general) only expresses a
> degenerate
> >> tree structure (i.e. a linear structure):
> >
> > Is that true? I've used RangeEx-like facilities (that I wrote)
> mostly
> > for more complicated trees, such as set operations.
> "in general," meaning "most of the time."

What I meant to say was, are you expressing your personal experience
with using RangeEx? Or a hunch about what most users will use it for? Or
the lazy adaptors that the current version of RangeEx has? FWIW, My
personal experience is different.

> > I do know that I find that "merge()" returning ranges
> > copy (merge (rng1, rng2) | transform (f), output_it);
> > gives expressiveness than
> ^^^^^^^^^^^^^^^^^^^
> Parse error. I don't understand what you're trying to say.

Sorry about that. What I tried to say was that I find
        copy (transform (merge (rng1, rng2), func), output_it);
or, if you wish
        copy (merge (rng1, rng2) | transform (func), output_it);
more expressive than
        vector <T> intermediate;
        merge (rng1, rng2, back_inserter(intermediate));
        transform (intermediate, output_it, func);


Boost list run by bdawes at, gregod at, cpdaniel at, john at