cgal/STL_Extension/doc_tex/STL_Extension_ref/Default.tex

46 lines
1.6 KiB
TeX

\begin{ccRefClass}{Default}
\ccDefinition
\ccRefName\ is a tag class. It can be used to explicitly state that one wants
to use the default value of a template parameter of a class template.
This can be useful in several cases: (a) when one needs a non-default value for
another template parameter coming next (since \CC\ only supports defaults at
the end of lists), (b) when the default is actually a complex expression, e.g.
refering to previous template parameters (in this case, it shortens compiler
error messages and mangled symbol names), (c) when defining the default
involves circular dependencies of type instantiations (there, it breaks the
cycle in a nice way).
In order for this mechanism to work, the template class needs to do some
special treatment, and its documentation should state whether or not this
possibility is supported.
Also beware that the type of the template class will not be the same when
instantiating it using \ccRefName\ instead of the real default type, even
though their interface will otherwise be the same. This may have consequences
in some rare cases.
\ccIsModel
\ccc{DefaultConstructible, CopyConstructible}
\begin{ccAdvanced}
\ccTypes
In order to help the template class writer, \ccRefName\ provides a
convenient way to extract the desired value for an argument which may be
defaulted using \ccRefName.
\ccNestedType{template <typename Argument, typename Value> struct Get;}
{A nested template providing a typedef \ccc{type} which equals \ccc{Value} if
\ccc{Argument} is \ccRefName, and \ccc{Argument} otherwise.}
\end{ccAdvanced}
\ccHeading{Example}
\ccIncludeExampleCode{STL_Extension/Default.cpp}
\end{ccRefClass}