C++ Logo

std-discussion

Advanced search

Re: Not understanding rvalue reference matching rules in overloaded functions.

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Tue, 1 Jun 2021 17:42:25 +0100
On Tue, 1 Jun 2021 at 17:32, language.lawyer--- via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> On 01/06/2021 16:54, Edward Diener via Std-Discussion wrote:
> > Since std::move creates an rvalue reference
>
> There is no such thing as ┬źcreate reference┬╗ in C++.
> And the type of the `std::move(i)` is `int`.
>

The types int&, int&&, int correspond perfectly well to int lvalue, int
xvalue, int prvalue, so it's reasonable to describe - as a shorthand - an
expression with type int and value category xvalue as having type int&&.

Received on 2021-06-01 11:44:19