1 .. Metafunctions/Concepts//Metafunction |10
9 .. _`nullary-metafunction`:
11 A *metafunction* is a class or a class template that represents a
12 function invocable at compile-time. An non-nullary metafunction is
13 invoked by instantiating the class template with particular
14 template parameters (metafunction arguments); the result of the
15 metafunction application is accessible through the instantiation's
16 nested ``type`` typedef. All metafunction's arguments must be types
17 (i.e. only *type template parameters* are allowed). A metafunction
18 can have a variable number of parameters. A *nullary metafunction* is
19 represented as a (template) class with a nested ``type`` typename
22 .. |nullary metafunction| replace:: `nullary-metafunction`_
25 Expression requirements
26 -----------------------
28 |In the following table...| ``f`` is a |Metafunction|.
30 +-------------------------------+-----------------------+---------------------------+
31 | Expression | Type | Complexity |
32 +===============================+=======================+===========================+
33 | ``f::type`` | Any type | Unspecified. |
34 +-------------------------------+-----------------------+---------------------------+
35 | ``f<>::type`` | Any type | Unspecified. |
36 +-------------------------------+-----------------------+---------------------------+
37 | ``f<a1,..,an>::type`` | Any type | Unspecified. |
38 +-------------------------------+-----------------------+---------------------------+
49 ``f`` is a nullary |Metafunction|; ``f::type`` is a *type-name*.
52 ``x`` is the result of the metafunction invocation.
55 .. ...................................................................................
62 ``f`` is a nullary |Metafunction|; ``f<>::type`` is a *type-name*.
65 ``x`` is the result of the metafunction invocation.
68 .. ...................................................................................
72 typedef f<a1,\ |...| \a\ *n*\>::type x;
75 ``f`` is an *n*-ary |Metafunction|; |a1...an| are types;
76 ``f<a1,...an>::type`` is a *type-name*.
79 ``x`` is the result of the metafunction invocation
80 with the actual arguments |a1...an|.
96 |Metafunctions|, |Metafunction Class|, |Lambda Expression|, |Invocation|, |apply|, |lambda|, |bind|
99 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
100 Distributed under the Boost Software License, Version 1.0. (See accompanying
101 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)