@@ -3003,6 +3003,47 @@ \section{Increment/decrement Operators}
3003
3003
\normalsize
3004
3004
3005
3005
3006
+ \section {Trailing Return Types }
3007
+ \label {sec:TrailingReturnTypes }
3008
+
3009
+ Whenever choosing between a trailing return type (as introduced with C++11) and
3010
+ the old form of having the return type before the function name (as was already
3011
+ supported by C++98), prefer the form that is the shortest, and the simplest.
3012
+
3013
+ In the following example, the old form is preferred over a trailing return type:
3014
+ \small
3015
+ \begin {minted }[baselinestretch=1,fontsize=\footnotesize ,linenos=false,bgcolor=ltgray]{cpp}
3016
+ // Preferred:
3017
+ template <typename T1, typename T2>
3018
+ bool
3019
+ AlmostEquals(T1 x1, T2 x2)
3020
+
3021
+ // Rather than:
3022
+ template <typename T1, typename T2>
3023
+ auto
3024
+ AlmostEquals(T1 x1, T2 x2) -> bool
3025
+ \end {minted }
3026
+ \normalsize
3027
+
3028
+ In the following example, a trailing return type is preferred over the old form:
3029
+
3030
+ \small
3031
+ \begin {minted }[baselinestretch=1,fontsize=\footnotesize ,linenos=false,bgcolor=ltgray]{cpp}
3032
+
3033
+ // Preferred:
3034
+ template <typename TValue, unsigned int VLength>
3035
+ auto
3036
+ FixedArray<TValue, VLength>::Size() const -> SizeType
3037
+
3038
+ // Rather than:
3039
+ template <typename TValue, unsigned int VLength>
3040
+ typename FixedArray<TValue, VLength>::SizeType
3041
+ FixedArray<TValue, VLength>::Size() const
3042
+
3043
+ \end {minted }
3044
+ \normalsize
3045
+
3046
+
3006
3047
\section {Empty Arguments in Methods }
3007
3048
\label {sec:EmptyArgumentInMethods }
3008
3049
0 commit comments