Front Page / Metafunctions / Concepts / Trivial Metafunction |
A Trivial Metafunction accepts a single argument of a class type x and returns the x's nested type member x::name, where name is a placeholder token for the actual member's name accessed by a specific metafunction's instance. By convention, all trivial metafunctions in MPL are named after the members they provide assess to. For instance, a Trivial Metafunction named first reaches for the x's nested member ::first.
In the following table and subsequent specifications, name is placeholder token for the names of the Trivial Metafunction itself and the accessed member, and x is a class type such that x::name is a valid type-name.
Expression | Type | Complexity |
---|---|---|
name<x>::type | Any type | Constant time. |
typedef name<x>::type r;
Precondition: | x::name is a valid type-name. |
---|---|
Semantics: | is_same<r,x::name>::value == true. |