cppx-core
|
$with
binds the specified declarator to auto&& _
in the following braces block.
More...
Go to the source code of this file.
Macros | |
#define | with CPPX_WITH |
Real name: $with (the $ is just removed by Doxygen). More... | |
#define | with_const CPPX_WITH_CONST |
Real name: $with_const (the $ is just removed by Doxygen). More... | |
#define | CPPX_WITH(...) if ( auto&& _ [[maybe_unused]] = __VA_ARGS__; true ) |
Binds the specified declarator to auto&& _ in the following braces block. More... | |
#define | CPPX_WITH_CONST(...) if( const auto& _ [[maybe_unused]] = __VA_ARGS__; true ) |
Binds the specified declarator to const auto& _ in the following braces block. More... | |
$with
binds the specified declarator to auto&& _
in the following braces block.
Definition in file macro-with.hpp.
#define CPPX_WITH | ( | ... | ) | if ( auto&& _ [[maybe_unused]] = __VA_ARGS__; true ) |
Binds the specified declarator to auto&& _
in the following braces block.
$with
can be used to make clear that an object is used for constructor + destructor execution (RAII), or that it's used just to hold a temporary result in order to access parts of it using the _
name.
RAII examples:
$with( Lock( mutex ) ) access_resource();
$with( Const_<Lock>( mutex ) ) access_resource();
Definition at line 25 of file macro-with.hpp.
#define CPPX_WITH_CONST | ( | ... | ) | if( const auto& _ [[maybe_unused]] = __VA_ARGS__; true ) |
Binds the specified declarator to const auto& _
in the following braces block.
For example:
$with_const( Lock( mutex ) ) access_resource();
Definition at line 32 of file macro-with.hpp.
#define with CPPX_WITH |
Real name: $with
(the $
is just removed by Doxygen).
Definition at line 7 of file macro-with.hpp.
#define with_const CPPX_WITH_CONST |
Real name: $with_const
(the $
is just removed by Doxygen).
Definition at line 8 of file macro-with.hpp.