Class templates for type decomposition

| Home | Libraries | People | FAQ | More

### Class templates for type decomposition

#### result_type

    template<typename F>
    struct result_type;

Header

    #include <boost/function_types/result_type.hpp>

`F`

  Type to analyze

`result_type<F>::type`

  Result type of `F`

Extracts the result type of a callable, builtin type.

If `F` is no callable, builtin type, any attempt to access the `type` member results in a compile error.

#### parameter_types

    template<typename F, class ClassTransform = add_reference<_> >
    struct parameter_types;

Header

    #include <boost/function_types/parameter_types.hpp>

`F`

  Type to analyze

`ClassTransform`

  MPL - Lambda Expression to transform the class type if `F` is a member function pointer

`parameter_types<F,ClassTransform>`

  MPL - Front / Back Extensible Random Access Sequence of parameter types

Extracts the parameter types of a callable, builtin type.

If `F` is no callable, builtin type, any attempt to access the sequence results in a compile error.

#### function_arity

    template<typename F>
    struct function_arity;

Header

    #include <boost/function_types/function_arity.hpp>

`F`

  Callable builtin type

`function_arity<F>`

  Function arity as MPL - Integral Constant

`function_arity<F>::value`

  Constant value of the function arity

Extracts the function arity, that is the number of parameters. The hidden `this` of member function pointers counts, in other words the arity value is always greater than or equal to one if `F` is a member function pointer.

If `F` is no callable, builtin type, any attempt to access the value results in a compile error.

#### components

    template<typename T, class ClassTransform = add_reference<_> >
    struct components;

Header

    #include <boost/function_types/components.hpp>

`T`

  Type to analyze

`ClassTransform`

  MPL - Lambda Expression to transform the class type if `T` is a member function pointer

`components<T,ClassTransform>`

  MPL - Front / Back Extensible Random Access Sequence of all component types and property tag

`components<T,ClassTransform>::types`

  Decorated MPL Sequence, exposed for optimization

Extracts all properties of a callable builtin type, that is the result type, followed by the parameter types (including the type of `this` for member function pointers).

If `T` is no callable builtin type, the component types are an empty sequence and the Tag's meaning is equivalent to the `null_tag`.

| Copyright © 2004 -2007 Tobias Schwinger