cppannotations/annotations/yo/functiontemplates/summary.yo

34 lines
1.3 KiB
Text

In this section the basic syntactic constructions for declaring templates
are summarized. When em(defining) templates, the terminating
semicolon should be replaced by a function body.
Not every template declaration may be converted into a template definition. If
a definition may be provided it is explicitly mentioned.
itemization(
it() A plain template declaration (a definition may be provided):
verb(
template <typename Type1, typename Type2>
void function(Type1 const &t1, Type2 const &t2);
)
it() A template instantiation declaration (no definition may be provided):
verb(
template
void function<int, double>(int const &t1, double const &t2);
)
it() A template using explicit types (no definition may be provided):
verb(
void (*fp)(double, double) = function<double, double>;
void (*fp)(int, int) = function<int, int>;
)
it() A template explicit specialization (a definition may be provided):
verb(
template <>
void function<char *, char *>(char *const &t1, char *const &t2);
)
it() A template declaration declaring friend function templates within
hi(class template: friend function template) class templates (covered
in section ref(TEMPFRIENDS), no definition may be provided):
verb(
friend void function<Type1, Type2>(parameters);
)
)