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

Click here to view the latest version of this page.
PrevUpHomeNext

Macro BOOST_LOCAL_FUNCTION_ID

BOOST_LOCAL_FUNCTION_ID — This macro allows to declare multiple local functions on the same line.

Synopsis

// In header: <boost/local_function.hpp>

BOOST_LOCAL_FUNCTION_ID(id, declarations)

Description

This macro is equivalent to BOOST_LOCAL_FUNCTION but it can be expanded multiple times on the same line if different identifiers id are provided for each expansion (see the Advanced Topics section).

Parameters:

id A unique identifier token which can be concatenated by the preprocessor (__LINE__, local_function_number_1_on_line_123, etc).
declarations Same as the declarations parameter of the BOOST_LOCAL_FUNCTION macro.

The BOOST_LOCAL_FUNCTION_NAME macro should be used to end each one of the multiple local function declarations as usual (and it will specify a unique name for each local function).

Within templates, the special macros BOOST_LOCAL_FUNCTION_TPL_ID must be used.

Note: This macro can be useful when the local function macros are expanded within user-defined macros (because macros all expand on the same line). On some compilers (e.g., MSVC which supports the non-standard __COUNTER__ macro) it might not be necessary to use this macro but the use of this macro when expanding multiple local function macros on the same line is always necessary to ensure portability (this is because this library can only portably use __LINE__ to internally generate unique identifiers).

See: Advanced Topics section, BOOST_LOCAL_FUNCTION, BOOST_LOCAL_FUNCTION_NAME, BOOST_LOCAL_FUNCTION_TPL_ID.


PrevUpHomeNext