Time for a short post on using lambdas to construct macros… that was a sentence that will be able to trigger 2 camps in one go :D
Defer
First of, using lambdas to implement a defer()
is really neat, however others has already written about that so that I don’t have to!
Call once
So from my end I’ll start of with a quick one for constructing a macro that only does something once, lets call it IS_FIRST_CALL()
.
This can be used for things such as only logging something once or just asserting once. I’ll leave it to the reader to decide if this is a “good” thing but it is absolutely things I have seen “in the wild”.