C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Proposal regarding labeld breaking and continuation

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Fri, 17 Feb 2023 09:49:47 -0500
On Fri, Feb 17, 2023 at 9:41 AM Hypatia (of) Sva via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
> [...] But I appreciate the other idea, is there any new contruct using
> arrow
> notation? (the only thing Im aware of are trailing return types and
> pointed-to structs).
>

C++17 added deduction guides:
    template<class> struct S {};
    S() -> S<int>;
C++20 added requires-expressions:
    template<class> concept C = true;
    bool b = requires { { 42 } -> C; };

But these are all rightward arrows -> using the existing arrow token; C++
has no token for leftward arrow <- and in fact introducing such a token
would break the grammar of
    template<int> struct A {};
    A<-1> a;

HTH,
Arthur

Received on 2023-02-17 14:50:00