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 an old version of Boost. Click here to view this page for the latest version.
Front Page / Macros / Configuration / BOOST_MPL_LIMIT_METAFUNCTION_ARITY

BOOST_MPL_LIMIT_METAFUNCTION_ARITY

Synopsis

#if !defined(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
#   define BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
        implementation-defined integral constant \
/**/
#endif

Description

BOOST_MPL_LIMIT_METAFUNCTION_ARITY is an overridable configuration macro regulating the maximum supported arity of metafunctions and metafunction classes. In this implementation of the library, BOOST_MPL_LIMIT_METAFUNCTION_ARITY has a default value of 5. To override the default limit, define BOOST_MPL_LIMIT_METAFUNCTION_ARITY to the desired maximum arity before including any library header. [Note: Overriding will take effect only if the library is configured not to use preprocessed headers. See BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS for more information. — end note]

Example

#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 2
#include <boost/mpl/apply.hpp>

using namespace boost::mpl;

template< typename T1, typename T2 > struct second
{
    typedef T2 type;
};

template< typename T1, typename T2, typename T3 > struct third
{
    typedef T3 type;
};

typedef apply< second<_1,_2_>,int,long >::type r1;
// typedef apply< third<_1,_2_,_3>,int,long,float >::type r2; // error!

See also

Macros, Configuration, BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS