Home | Libraries | People | FAQ | More |
BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS — Force to use C++11 lambda functions to implement scope exits.
// In header: <boost/scope_exit.hpp>
BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS
If programmers define this configuration macro on a C++11 compiler for which the Boost.Config macro BOOST_NO_CXX11_LAMBDAS
is not defined, the BOOST_SCOPE_EXIT
and BOOST_SCOPE_EXIT_TPL
macros will use C++11 lambda functions to declare scope exits. By default this macro is not defined.
Warning: When scope exits are implemented using lambda functions, the syntax of the capture list follows the exact same syntax of C++11 lambda captures which is in general different from the legacy capture syntax of this library. For example, C++11 lambdas require to capture data members by capturing the object this
while this library always allowed to capture data members directly. Therefore, when this configuration macro is defined, BOOST_SCOPE_EXIT
and BOOST_SCOPE_EXIT_TPL
are no longer backward compatible (and this is why this macro is not defined by default).
A semicolon ;
can be used instead of BOOST_SCOPE_EXIT_END
when this configuration macro is defined (but it is recommended to always use BOOST_SCOPE_EXIT_END
so to maximize portability).
Note: This configuration macro does not control the definition of BOOST_SCOPE_EXIT_ALL
which is always and automatically defined on compilers that support C++11 lambda functions.
See: BOOST_SCOPE_EXIT
, BOOST_SCOPE_EXIT_TPL
, BOOST_SCOPE_EXIT_END
.