Back to Arangodb

Metafunction

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/metafunction.html

3.12.9.12.9 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Metafunctions / Concepts / Metafunction |

Metafunction

Description

A metafunction is a class or a class template that represents a function invocable at compile-time. An non-nullary metafunction is invoked by instantiating the class template with particular template parameters (metafunction arguments); the result of the metafunction application is accessible through the instantiation's nested type typedef. All metafunction's arguments must be types (i.e. only type template parameters are allowed). A metafunction can have a variable number of parameters. A nullary metafunction is represented as a (template) class with a nested type typename member.

Expression requirements

In the following table and subsequent specifications, f is a Metafunction.

ExpressionTypeComplexity
f::typeAny typeUnspecified.
f<>::typeAny typeUnspecified.
f<a1,..,an>::typeAny typeUnspecified.

Expression semantics

typedef f::type x;

| Precondition: | f is a nullary Metafunction; f::type is a type-name. | | Semantics: | x is the result of the metafunction invocation. |

typedef f<>::type x;

| Precondition: | f is a nullary Metafunction; f<>::type is a type-name. | | Semantics: | x is the result of the metafunction invocation. |

typedef f<a1,_..._a_n_>::type x;

| Precondition: | f is an n-ary Metafunction; a1,... an are types; f<a1,...an>::type is a type-name. | | Semantics: | x is the result of the metafunction invocation with the actual arguments a1,... an. |

Models

See also

Metafunctions, Metafunction Class, Lambda Expression, invocation, apply, lambda, bind

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |