...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
BOOST_LOCAL_FUNCTION_ID_TPL — This macro allows to declare multiple local functions on the same line within templates.
// In header: <boost/local_function.hpp>
BOOST_LOCAL_FUNCTION_ID_TPL(id, declarations)
This macro must be used instead of BOOST_LOCAL_FUNCTION_TPL
when declaring multiple local functions on the same line within a template. A part from that, this macro has the exact same syntax as BOOST_LOCAL_FUNCTION_TPL
(see BOOST_LOCAL_FUNCTION_TPL
for more information).
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_TPL 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).
Outside template, the macro BOOST_LOCAL_FUNCTION_ID
should be used to declare multiple local functions on the same line.
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_TPL
, BOOST_LOCAL_FUNCTION_NAME
, BOOST_LOCAL_FUNCTION_ID
.