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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Macro BOOST_SCOPE_EXIT_ALL_ID

BOOST_SCOPE_EXIT_ALL_ID — This macro allows to expand on the same line multiple scope exits that capture all variables in scope (C++11 only).

Synopsis

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

BOOST_SCOPE_EXIT_ALL_ID(id, capture_list)

Description

This macro is equivalent to BOOST_SCOPE_EXIT_ALL but it can be expanded multiple times on the same line if different identifiers id are provided for each expansion (see BOOST_SCOPE_EXIT_ALL for more information). As with BOOST_SCOPE_EXIT_ALL, this macro is only available on C++11 compilers (specifically, on C++11 compilers that do not define the Boost.Config BOOST_NO_LAMBDAS macro).

Parameters:

id A unique identifier token which can be concatenated by the preprocessor (__LINE__, scope_exit_number_1_on_line_123, a combination of alphanumeric tokens, etc).
capture_list Same as the capture_list parameter of the BOOST_SCOPE_EXIT_ALL macro.

Note: This macro can be useful when the scope exit macros are expanded within user-defined macros (because nested macros 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 is always necessary to ensure portability when expanding multiple scope exit declarations on the same line.

See: Tutorial section, BOOST_SCOPE_EXIT_ALL, BOOST_SCOPE_EXIT_ID.


PrevUpHomeNext