C ++ 11: standard ref for `auto` action on const and reference types

Suppose I have type T:

typedef ... T;

and then I have the following 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 / articles of the C ++ 11 standard can the equivalent non-automatic declarations x11..x23 be derived?

+5
source share
1 answer

Section 7.1.6.4 auto-specifier . In the examples of returned function types, the rules for deriving template arguments apply.

Parasofting of the corresponding example with the standard:

const auto &i = expr;

Type iis the deduced type of parameter X in a call to the f(expr)following invented function template:

template <class AUTO> void f(const AUTO& X);

, x11 - x23 T.

+5

All Articles