Template¶
Breathe has support for class and function templates. They are output as follows. For a class with a single template parameter:
.. doxygenclass:: templateclass
:project: template_class
:members:
It renders as:
-
template<typename
T
>
classtemplateclass
¶ a class with a template parameter
- Template Parameters
T – this is the template parameter
Public Functions
-
inline
templateclass
()¶ default constructor
With multiple template parameters it renders as:
-
template<typename
T
, typenameU
, intN
>
classanothertemplateclass
¶ a class with three template parameters
- Template Parameters
T – this is the first template parameter
U – this is the second template parameter
N – this is the third template parameter, it is a non-type parameter
A function with single template parameter renders as:
-
template<typename
T
>
Tfunction1
(T arg1)¶ a function with one template arguments
- Template Parameters
T – this is the template parameter
- Parameters
arg1 – argument of type T
- Returns
return value of type T
If specialized for a given type it renders as:
-
template<>
std::stringfunction1
<std::string>(std::string arg1)¶ a function with one template argument specialized for
std::string
- Parameters
arg1 – argument of type
std::string
- Returns
return value of type
std::string
With multiple template parameters it renders as:
-
template<typename
T
, typenameU
, intN
>
Tfunction2
(T arg1, U arg2)¶ a function with three template arguments
- Template Parameters
T – this is the first template parameter
U – this is the second template parameter
N – this is the third template parameter, it is a non-type parameter
- Parameters
arg1 – first argument of type T
arg2 – second argument of type U
- Returns
return value of type T