1[#metafunction_class] 2[section Template metafunction class] 3 4A ['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 6passed to template metafunctions as arguments and metafunctions can return it as 7their result. This makes it possible to implement 8['higher-order template metafunctions], which are template metafunctions taking 9template metafunctions as arguments or returning template metafunctions as their 10result. 11 12For example this is the identity template metafunction class: 13 14 struct identity 15 { 16 template <class T> 17 struct apply 18 { 19 using type = T; 20 }; 21 using type = identity; 22 }; 23 24This metafunction class is called `identity`. It takes one argument, `T`. The 25result 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 28argument or the result of a template metafunction. 29 30To call this metafunction, one has to call the nested template metafunction. 31For example: 32 33 identity::apply<std::integral_constant<int, 13>>::type 34 35The above example calls the metafunction class `identity` with 36`std::integral_constant<int, 13>` as its argument. 37 38[endsect] 39 40