"if not" condition check (for data validation)

Dukc ajieskola at gmail.com
Thu Jun 18 13:57:39 UTC 2020


On Thursday, 18 June 2020 at 12:50:35 UTC, Stanislav Blinov wrote:
>
> auto not(alias cond)() { return !cond(); }
>
> if (not!(() => abra && cadabra)) ...
>
> but that is indeed even less readable.

No reason to use templates here

```
pragma(inline, true) auto not(bool cond) { return !cond(); }

if (not!(abra && cadabra)) ...
//same as above
if (abra.not || cadabra.not) ...
```


More information about the Digitalmars-d-learn mailing list