@@ -44,8 +44,10 @@ \section{Overview}
4444\item \textbf {Naming Conventions }: patterns used to name classes, variables,
4545template parameters, and instance variables.
4646\item \textbf {Namespaces }: the use of namespaces.
47- \item \textbf {Aliasing Template Parameters Typenames }: guidelines on aliasing
47+ \item \textbf {Aliasing Template Parameter Typenames }: guidelines on aliasing
4848template parameter typenames in a class.
49+ \item \textbf {The auto Keyword }: when and when not to use the \code {auto}
50+ keyword.
4951\item \textbf {Pipelines }: useful tips when writing pipelines in ITK.
5052\item \textbf {Initialization and Assignment }: accepted standards for variable
5153initialization and assignment.
@@ -1428,6 +1430,33 @@ \section{Pipelines}
14281430
14291431\end {itemize }
14301432
1433+ \section {The auto Keyword }
1434+ \label {sec:TheAutoKeyword }
1435+
1436+ Available since C++11, the \code {auto} keyword specifies that a variable's type
1437+ is automatically deduced from its initializer.
1438+
1439+ The \code {auto} keyword should be used to specify a type in the following cases:
1440+
1441+ \begin {itemize }
1442+ \item The type is duplicated on the left side of an assigment when it is mandated on the
1443+ right side, e.g. when there is an explicit cast or initializing with \code {new} or ITK's \code {::New()}.
1444+ \item When obtaining container elements, when the element type is obvious from the type
1445+ of the container.
1446+ \item When the type does not matter because it is not being used for anything other
1447+ than equality comparison.
1448+ \item When declaring iterators in a \code {for} loop.
1449+ \item When a trailing return type is used in a function declaration.
1450+ \item When creating lambda functions.
1451+ \end {itemize }
1452+
1453+ All other cases should not use \code {auto}, but a semantic type name
1454+ should be used that conveys meaning, as described in Section~\ref {sec:NamingConventions }
1455+ and Section~\ref {subsec:NamingTypedefs } on page~\pageref {subsec:NamingTypedefs }.
1456+
1457+ Application or example code that uses ITK, as opposed to the toolkit itself,
1458+ may use \code {auto} more liberally.
1459+
14311460
14321461\section {Initialization and Assignment }
14331462\label {sec:IniitalizationAndAssignment }
0 commit comments