C++ Logo

std-proposals

Advanced search

Re: Python-style comprehensive containers

From: Phil Bouchard <boost_at_[hidden]>
Date: Wed, 16 Jun 2021 14:59:52 -0400
On 6/16/21 2:50 PM, Jason McKesson via Std-Proposals wrote:
> On Wed, Jun 16, 2021 at 7:54 AM Phil Bouchard via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
>> Greetings,
>>
>>
>> 1) I admit code is quite clean using Python-style comprehensive containers. So by looking around I know there is the following already available:
>>
>> https://www.codeproject.com/Tips/5276120/Multi-Container-List-Comprehension-in-Cplusplus
>>
>>
>> 2) But I'm sure there is a way to mix that with the new pipe operator to make it even cleaner:
> There is no "new pipe operator" in the standard (as far as I'm aware).
> The pipe operator is the normal, existing pipe operator from the days
> of C++98.

You're right, I did read very quickly on this but it's the standard OR
operator being used differently:

http://pfultz2.com/blog/2014/09/05/pipable-functions/

>
> There are overloads of this operator for ranges, but they don't
> magically create syntax. They're just regular operator overloading.
> And operator overloading can't make "each(x, x*x)" behave in any way
> differently from how it would work on its own.

So there would seem be be a need here since this is not yet implemented
if I am right.

I did study parallel algorithms back in my school days but I can try
recalling hypercubes and all that so that it becomes possible eventually
to implement such functionality in C++.

-- 
*Phil Bouchard*
Founder & CTO
C.: (819) 328-4743
Fornux Logo <http://www.fornux.com>

Received on 2021-06-16 13:59:57