dimanche 15 janvier 2023

What does "int*&&" do in C++?

I'm coming from a C# background and trying to learn a little C++. I came across the following lines:

int x[3] = { 1, 2, 3 };
int*&& y = x;
int* z = y;

I know what pointers and arrays are and have some small understanding on lvalue and rvalue references. However I can't wrap my head around what int*&& y = x; actually does. It would read like it creates a pointer to an rvalue reference, is this correct? What would be the use case of something like that, e.g. what is going on in memory if we execute this?

Aucun commentaire:

Enregistrer un commentaire