completing first/auto.yo

This commit is contained in:
Frank B. Brokken 2017-02-17 18:26:17 +01:00
parent 1917e40a5d
commit f45c1519e8

View file

@ -87,7 +87,7 @@ so tt(int *const &ip4) is defined.
The tt(auto) keyword can also be used to postpone the definition of a
function's return type. The declaration of a function tt(intArrPtr) returning
a pointer to an array of 10 tt(int)s looks like this:
a pointer to arrays of 10 tt(int)s looks like this:
verb(
int (*intArrPtr())[10];
)
@ -107,15 +107,6 @@ any other specification the function might receive (e.g., as a const member
A return type specification using tt(auto) is called a
emi(late-specified return type).
The tt(auto) keyword can also be used to defined types that are related to
the actual tt(auto) associated type. Here are some examples:
verb(
vector<int> vi;
auto iter = vi.begin(); // standard: auto is vector<int>::iterator
auto &&rref = vi.begin(); // auto is rvalue ref. to the iterator type
auto *ptr = &iter; // auto is pointer to the iterator type
auto *ptr = &rref; // same
)
Since the C++14 standard late return type specifications are no longer
required for functions returning tt(auto). Such functions can now simply be
@ -127,7 +118,7 @@ declared like this:
the function declarations:
itemization(
it() If multiple return statements are used in function definitions they
all must be of the same type;
all must return values of identical types;
it() Functions merely returning tt(auto) cannot be used before the
compiler has seen their definitions. So they cannot be used after mere
declarations;