From f45c1519e809fb4ded5cd25046b2e77c0510d75f Mon Sep 17 00:00:00 2001 From: "Frank B. Brokken" Date: Fri, 17 Feb 2017 18:26:17 +0100 Subject: [PATCH] completing first/auto.yo --- annotations/yo/first/auto.yo | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/annotations/yo/first/auto.yo b/annotations/yo/first/auto.yo index a407fc1f..c5aa6025 100644 --- a/annotations/yo/first/auto.yo +++ b/annotations/yo/first/auto.yo @@ -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 vi; - auto iter = vi.begin(); // standard: auto is vector::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;