Suppose I have a type T:
typedef ... T;
and then I have these functions:
T f11();
T& f12();
T&& f13();
const T f21();
const T& f22();
const T&& f23();
and then call them like this:
auto x11 = f11();
auto x12 = f12();
auto x13 = f13();
auto x21 = f21();
auto x22 = f22();
auto x23 = f23();
From which sections/clauses of the C++11 standard can it be deduced the equivalent non-auto declarations of x11..x23?
It is in §7.1.6.4 auto specifier. In your examples of function return types, the rules of template argument deduction apply.
Paraquoting the relevant example from the standard:
const auto &i = expr;
The type of
i
is the deduced type of the parameter X in the callf(expr)
of the following invented function template:
template <class AUTO> void f(const AUTO& X);
So in your examples, the types of all your variables x11
to x23
are deduced as T
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With