C++ Logo

std-proposals

Advanced search

Re: Initialisers in ternary operators

From: Jorg Brown <jorg.brown_at_[hidden]>
Date: Tue, 15 Sep 2020 12:37:42 -0700
On Mon, Sep 14, 2020 at 6:18 AM Dmitry Dmitry via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> The first question that springs to mind is "where do I place the
>> breakpoint so I can see the current state of this algorithm?"
>>
>
> This was my first question as well :)
>

So I'm looking at http://wg21.link/p0798 ...

I get that you don't like (nor do I):

std::optional<image> get_cute_cat (const image& img) {
    return crop_to_cat(img)
           .and_then(add_bow_tie)
           .and_then(make_eyes_sparkle)
           .transform(make_smaller)
           .transform(add_rainbow);
}

I'm curious if you would allow the pre-P0798 version:

image get_cute_cat (const image& img) {
    return add_rainbow(
             make_smaller(
               make_eyes_sparkle(
                 add_bow_tie(
                   crop_to_cat(img))));
}

-- Jorg

Received on 2020-09-15 14:37:56