C++11—Trailing Return Types for Functions

Image

C++11 introduces trailing return types for functions. To specify a trailing return type you place the keyword auto before the function name, then follow the function’s parameter list with -> and the return type. For example, to specify a trailing return type for function template maximum (Fig. 6.24), you’d write

template < typename T >
auto maximum( T x, T y, T z ) -> T

As you build more complex function templates, there are cases for which only trailing return types are allowed. Such complex function templates are beyond this book’s scope.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.150.56