Namespaces
Variants
Views
Actions

Talk:cpp/types/add reference

From cppreference.com

The phrase " If T is an object type or a function type that has no cv- or ref- qualifier (since C++17),... " is grammatically misleading. The clause "that has no cv- or ref- qualifier (since C++17)" applies only to a function type and not to an object type. I suggest adding a comma: " If T is an object type, or T is a function type that has no cv- or ref- qualifier (since C++17),... " Mrolle (talk) 21:57, 6 January 2019 (PST)

[edit] Not explicit using of declaration in implementation

There is the declaration in the implementation that has been given for the instance

template <class T> auto try_add_lvalue_reference_(...) -> type_identity_<T>;

Could someone give an explanation of a need of using this declaration. Because as we can see further only first option is used (with parameter 0), so, the second one is never used but it seems it's needed...

176.15.243.222 13:47, 6 October 2020 (PDT) Ayrat A.

The second declaration is used when substitution of T=void into type_identity<T&> fails, the second declaration is then used to provide void as the result type --Ybab321 (talk) 04:30, 7 October 2020 (PDT)