C++ Logo


Advanced search

Re: Python-style comprehensive containers

From: Cleiton Santoia <cleitonsantoia_at_[hidden]>
Date: Fri, 18 Jun 2021 06:18:27 -0300
With C++ ranges today you can do :

    auto const ints = {0,1,2,3,4,5,6};
    auto d = ints | views::transform([](int x) { return x*2; });


You're right, I did read very quickly on this but it's the standard OR
> operator being used differently:
Well, I think that is a "good thing" if the language allows you to reuse
the syntax (operator overload) through library implementations without
changing the compiler.

> So there would seem be be a need here since this is not yet implemented if
> I am right.
Not yet, but being flexible to convert from ranges to *ANY* kind of
container may be challenging...


We are also trying to avoid macros... they are not module-friendly, not
bounded to the type system, among many other issues:



Received on 2021-06-18 04:18:58