Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit cf7c0df373.
PrevUpHomeNext

Macro Metafunctions

The TTI library uses macros to create metafunctions, in the current scope, for introspecting an inner element by name. Each macro for a particular type of inner element has two forms, the simple one where the first macro parameter designating the 'name' of the inner element is used to create the name of the metafunction, and the complex one where the first macro parameter, called 'trait', designates the name of the metafunction and the second macro parameter designates the 'name' to be introspected. Other than that difference, the two forms of the macro create metafunctions which have the exact same functionality.

To use these metafunctions you can include the main general header file 'boost/tti/tti.hpp', unless otherwise noted. Alternatively you can include a specific header file as given in the table below.

A table of these macros is given, based on the inner element whose existence the metaprogrammer is introspecting. More detailed explanations and examples for each of the macro metafunctions will follow this section in the documentation. The actual syntax for each macro metafunction can be found in the reference section, and examples of usage for all the macro metafunctions can be found in the "Using the Macro Metafunctions" section.

In the Template column below only the name generated by the simple form of the template is given since the name generated by the complex form is always 'trait' where 'trait' is the first parameter to the corresponding complex form macro.

All of the introspecting metafunctions in the table below return a boolean constant called 'value', which specifies whether or not the inner element exists. All of the metafunctions also have a nested type called 'type', which for each one is the type of the boolean constant value. This is always boost::mpl::bool_.

Table 1.2. TTI Macro Metafunctions

Inner Element

Macro

Template

Specific Header File

Type

BOOST_TTI_HAS_TYPE(name)

has_type_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner type and returning a boolean constant

has_type.hpp

Class/Struct

BOOST_TTI_HAS_CLASS(name)

has_class_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner class/struct and returning a boolean constant

has_class.hpp

Enumeration

BOOST_TTI_HAS_ENUM(name)

has_enum_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner enum and returning a boolean constant

has_enum.hpp

Union

BOOST_TTI_HAS_UNION(name)

has_union_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner union and returning a boolean constant

has_union.hpp

Class Template

Using variadic macros:

BOOST_TTI_HAS_TEMPLATE(name)

Not using variadic macros:

BOOST_TTI_HAS_TEMPLATE(name,BOOST_PP_NIL)

has_template_'name'

class BOOST_TTI_T = enclosing type

All of the template parameters must be template type parameters ( 'class' or 'typename' parameters )

has_template.hpp

Class Template with params

Using variadic macros:

BOOST_TTI_HAS_TEMPLATE(name,...[a])

Not using variadic macros:

BOOST_TTI_HAS_TEMPLATE(name,ppArray[b])

has_template_'name'

class BOOST_TTI_T = enclosing type

has_template.hpp

Member data

BOOST_TTI_HAS_MEMBER_DATA(name)

has_member_data_'name'

class BOOST_TTI_T = enclosing type OR pointer to member data ( 'MemberData_Type Enclosing_Type::*' )

class BOOST_TTI_R = (optional) data type. If the first parameter is the pointer to member data this must not be specified.

has_member_data.hpp

Member function

BOOST_TTI_HAS_MEMBER_FUNCTION(name)

has_member_function_'name'

class BOOST_TTI_T = enclosing type OR pointer to member function ( 'Return_Type (Enclosing_Type::*) ( Zero or more comma-separated parameter types )' )

class BOOST_TTI_R = (optional) return type if the first parameter is the enclosing type. If the first parameter is the pointer to member function this must not be specified.

class BOOST_TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. If the first parameter is the pointer to member function this must not be specified. If there are no function parameters this does not have to be specified. Defaults to boost::mpl::vector<>.

class BOOST_TTI_TAG = (optional) Boost function_types tag type. If the first parameter is the pointer to member function this must not be specified. Defaults to boost::function_types::null_tag.

has_member_function.hpp

Member function template

Using variadic macros:

BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(name,...[c])

Not using variadic macros:

BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(name,ppArray[d])

has_member_function_template_'name'

class BOOST_TTI_T = enclosing type OR pointer to member function ( 'Instantiated return_type (Enclosing_Type::*) ( Zero or more comma-separated instantiated parameter types )' )

class BOOST_TTI_R = (optional) instantiated return type if the first parameter is the enclosing type. If the first parameter is the pointer to member function this must not be specified.

class BOOST_TTI_FS = (optional) instantiated function parameter types as a Boost MPL forward sequence. If the first parameter is the pointer to member function this must not be specified. If there are no function parameters this does not have to be specified. Defaults to boost::mpl::vector<>.

class BOOST_TTI_TAG = (optional) Boost function_types tag type. If the first parameter is the pointer to member function this must not be specified. Defaults to boost::function_types::null_tag.

has_member_function_template.hpp

Static member data

BOOST_TTI_HAS_STATIC_MEMBER_DATA(name)

has_static_member_data_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_TYPE = data type

has_static_member_data.hpp

Static member function

BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(name)

has_static_member_function_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_R = return type OR function type ( 'Return_Type (Zero or more comma-separated parameter types)' )

class BOOST_TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. If the second parameter is the function type this must not be specified. If there are no function parameters, this does not have to be specified. Defaults to boost::mpl::vector<>.

class BOOST_TTI_TAG = (optional) Boost function_types tag type. If the second parameter is the function type this must not be specified. Defaults to boost::function_types::null_tag.

has_static_member_function.hpp

Static member function template

Using variadic macros:

BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,...[e])

Not using variadic macros:

BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,ppArray[f])

has_static_member_function_template_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_R = instantiated return type OR function type ( 'Instantiated return_Type (Zero or more comma-separated instantiated parameter types)' )

class BOOST_TTI_FS = (optional) instantiated function parameter types as a Boost MPL forward sequence. If the second parameter is the function type this must not be specified. If there are no function parameters, this does not have to be specified. Defaults to boost::mpl::vector<>.

class BOOST_TTI_TAG = (optional) Boost function_types tag type. If the second parameter is the function type this must not be specified. Defaults to boost::function_types::null_tag.

has_static_member_function_template.hpp

Data, either member data or static member data

BOOST_TTI_HAS_DATA(name)

has_data_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_TYPE = data type

has_data.hpp

Function, either member function or static member function

BOOST_TTI_HAS_FUNCTION(name)

has_function_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_R = return type

class BOOST_TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. If there are no function parameters, this does not have to be specified. Defaults to boost::mpl::vector<>.

class BOOST_TTI_TAG = (optional) Boost function_types tag type. Defaults to boost::function_types::null_tag.

has_function.hpp

Function template, either member function template or static member function template

Using variadic macros:

BOOST_TTI_HAS_FUNCTION_TEMPLATE(name,...[g])

Not using variadic macros:

BOOST_TTI_HAS_FUNCTION_TEMPLATE(name,ppArray[h])

has_function_template_'name'

class BOOST_TTI_T = enclosing type

class BOOST_TTI_R = instantiated return type

class BOOST_TTI_FS = (optional) instantiated function parameter types as a Boost MPL forward sequence. If there are no function parameters, this does not have to be specified. Defaults to boost::mpl::vector<>.

class BOOST_TTI_TAG = (optional) Boost function_types tag type. Defaults to boost::function_types::null_tag.

has_function_template.hpp

[a] The template parameters as variadic data.

[b] The template parameters as the tuple part of a Boost PP array.

[c] The instantiated template parameters as variadic data.

[d] The instantiated template parameters as the tuple part of a Boost PP array.

[e] The instantiated template parameters as variadic data.

[f] The instantiated template parameters as the tuple part of a Boost PP array.

[g] The instantiated template parameters as variadic data.

[h] The instantiated template parameters as the tuple part of a Boost PP array.



PrevUpHomeNext