Code block as template argument
Andrea Fontana
nospam at example.com
Tue Feb 11 14:58:58 UTC 2020
On Tuesday, 11 February 2020 at 11:34:49 UTC, Ali Çehreli wrote:
> On 2/11/20 3:14 AM, Виталий Фадеев wrote:> On Tuesday, 11
> February 2020 at 11:10:44 UTC, Виталий Фадеев wrote:
>
> > Analog C-code with macros:
> > #define TPL(M,D,CODE) if ( state & M && diraction = D )
>
> ^^^^^^^^^^^^^
> [...]
>
> // Option 1: Equivalent of a C macro
> void executeMaybe(Func)(uint M, Direction D, Func func) {
> if ((state & M) && (direction == D)) {
> func();
> }
> }
>
> [...]
>
> Ali
The C code apparently does an assignment inside the macro.
More information about the Digitalmars-d
mailing list