C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fold expression contains 'if constexpr'

From: Magnus Fromreide <magfr_at_[hidden]>
Date: Tue, 6 Dec 2022 17:50:49 +0100
On Tue, Dec 06, 2022 at 09:33:11AM -0500, Jason McKesson via Std-Proposals wrote:
> On Tue, Dec 6, 2022 at 4:36 AM Magnus Fromreide via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > On Sun, Dec 04, 2022 at 11:13:45PM +0000, Frederick Virchanza Gotham via Std-Proposals wrote:
> > > On Sun, Dec 4, 2022 at 10:53 PM Thiago Macieira via Std-Proposals
> > > <std-proposals_at_[hidden]> wrote:
> > >
> > > > if constexpr ((requires{ get<Types>(p)->Method(a); } || ...))
> > > > return tailcall(a...);
> > >
> > >
> > > Note that my original function has "auto" as the return type, and so
> > > the "if else ladder" with the 'constexpr' keyword was able to pick out
> > > the correct return type.
> >
> > And this nicely illustrates why one should ask questions about the code
> > one want help with and not some other code.
>
> Um, he did. It's right there in the first post. I guess it more
> illustrates why one should read the entire text of a post before
> responding.

No, he didn't. Both versions in the first post contains the line

    decltype(pointers) &p = pointers;

but there is nothing in there that declares "pointers" or explains
what it is so both versions should rightly generate compile errors.

/MF

Received on 2022-12-06 16:50:52