2.6. Nullary MetafunctionsProbably the most important thing we've done in this chapter has been to describe the "metafunction" concept, but there's one question we still haven't answered: What does a nullary (zero-argument) metafunction look like? From the requirements standpoint, a nullary metafunction is any type, whether it's a plain class or a class template specialization, that provides us with a nested ::type member. For instance, add_const<int> is a nullary metafunction that always returns the same result: int const. The easiest way to write a nullary metafunction is to go with a simple struct: struct always_int { typedef int type; }; |