C++ Logo

std-discussion

Advanced search

Re: Positioning the && after the ...

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 30 Nov 2023 11:32:53 +0000
On Thu, Nov 30, 2023 at 10:58 AM Giuseppe D'Angelo wrote:
>
> Il 30/11/23 11:26, Frederick Virchanza Gotham via Std-Discussion ha scritto:
> > The syntax of Func1 makes more sense because we have to define
> > variables as follows:
> >
> > int &&a = monkey, &&b = donkey, &&c = fish;
> >
> > That is to say: The '&&' goes with the name -- not with the type.
>
> It goes with the type.


No it doesn't.

    int array[64u];

    int (&array2)[64u] = array;

If you want something to be a reference or a pointer, you put the
asterisk or the ampersand with the _name_.

Received on 2023-11-30 11:33:05