Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Macro BOOST_LOCAL_FUNCTION_ID

BOOST_LOCAL_FUNCTION_ID — This macro allows to expand multiple local function macros on the same line.

Synopsis

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

BOOST_LOCAL_FUNCTION_ID(id, within_template, 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 BOOST_LOCAL_FUNCTION for more detail).

Parameters:

id A unique identifier token which can be catted by the preprocessor (for example __LINE__ or local_function_number_1_on_line_123).
within_template Specify 1 when this macro is used in a type-dependant context, 0 otherwise (this is equivalent to using BOOST_LOCAL_FUNCTION_TPL on separate lines).
declarations Same as the declarations parameter of the BOOST_LOCAL_FUNCTION macro.

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

Note: The BOOST_LOCAL_FUNCTION_NAME macro can always be expanded multiple times on the same line because a unique local function name must be provided for each different expansion (so the is no need for a BOOST_LOCAL_FUNCTION_NAME_ID macro).

See: BOOST_LOCAL_FUNCTION, BOOST_LOCAL_FUNCTION_TPL.


PrevUpHomeNext