Boost C++ Libraries 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.


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


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



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'.