Trigger a matching closing braces that ends on the same level of nestedness. More...
Go to the source code of this file.
Trigger a matching closing braces that ends on the same level of nestedness.
As a simple example suppose that we want to mark {}
blocks that should always be surrounded by a do
... while(false)
construct. This can be achieved
To write a macro SWAP
that can be used anywhere a normal statement could be used such as in
you could use STATEMENT
to mark the opening brace:
The example from above would then be replaced by something like:
Note that if hadn't the STATEMENT
macro in SWAP
(only { ... }
) the replacement would have been
which is a syntax error because the else
looses its corresponding if
.
This replacement work even if the inner part of the macro would contain other nested {}
; the do
is always put in place of the STATEMENT
macro, the while (false)
after the closing brace that corresponds to the first opening brace after the STATEMENT
macro.
Evidently, this is only a not-so-interesting example to show how the feature works. If you want to see a more sophisticated use please refer to the LAMBDA
macro or the ellipsis-lambda.h header file.