C++ Logo

std-discussion

Advanced search

Re: add_rvalue_reference

From: Daniel Krügler <daniel.kruegler_at_[hidden]>
Date: Sat, 3 Jun 2023 13:28:29 +0200
Am Sa., 3. Juni 2023 um 13:23 Uhr schrieb Vladimir Grigoriev via
Std-Discussion <std-discussion_at_[hidden]>:
>
> It seems there is a typo in the table «Table 53: Reference modifications «.
>
> There is written
>
> «If T names a referenceable type then the member typedef type names T&&; otherwise, type names T.»
>
> Instead should it be
>
> «If T names a referenceable type then the member typedef type names T; otherwise, type names T&&.»?

No.

The type trait will *add* an rvalue reference, but it can only do so,
if the type is actually referencable. For example, void is not a
referencable type, so you cannot form void&&, therefore the result is
still void.

Thanks,

- Daniel

Received on 2023-06-03 11:28:42