2 [section Template metafunction class]
4 A ['template metafunction class] is a type with a public nested
5 [link metafunction template metafunction] called `apply`. Since it is a type, it can be
6 passed to template metafunctions as arguments and metafunctions can return it as
7 their result. This makes it possible to implement
8 ['higher-order template metafunctions], which are template metafunctions taking
9 template metafunctions as arguments or returning template metafunctions as their
12 For example this is the identity template metafunction class:
21 using type = identity;
24 This metafunction class is called `identity`. It takes one argument, `T`. The
25 result of calling this metafunction class is its argument, `T`. Note that the
26 `identity` metafunction class is also a
27 [link metaprogramming_value template metaprogramming value], so it can be an
28 argument or the result of a template metafunction.
30 To call this metafunction, one has to call the nested template metafunction.
33 identity::apply<std::integral_constant<int, 13>>::type
35 The above example calls the metafunction class `identity` with
36 `std::integral_constant<int, 13>` as its argument.