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

PrevUpHomeNext

Macro BOOST_VMD_IDENTITY

BOOST_VMD_IDENTITY — Macro which expands to its argument when invoked with any number of parameters.

Synopsis

// In header: <boost/vmd/identity.hpp>

BOOST_VMD_IDENTITY(item)

Description

item = any single argument

When BOOST_VMD_IDENTITY(item) is subsequently invoked with any number of parameters it expands to 'item'. Subsequently invoking the macro is done as 'BOOST_VMD_IDENTITY(item)(zero_or_more_arguments)'.

The macro is equivalent to the Boost PP macro BOOST_PP_IDENTITY(item) with the difference being that BOOST_PP_IDENTITY(item) is always invoked with no arguments, as in 'BOOST_VMD_IDENTITY(item)()' whereas BOOST_VMD_IDENTITY can be invoked with any number of arguments.

The macro is meant to be used in BOOST_PP_IF and BOOST_PP_IIF statements when only one of the clauses needs to be invoked with calling another macro and the other is meant to return an 'item'.

returns = the macro as 'BOOST_VMD_IDENTITY(item)', when invoked with any number of parameters as in '(zero_or_more_arguments)', returns 'item'. The macro itself returns 'item BOOST_VMD_EMPTY'.


PrevUpHomeNext