No TypeTuple expansion for assert?

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 3 12:20:50 PDT 2014


03-Oct-2014 23:08, Ali Çehreli пишет:
> I know that assert is not a function but it would be nice to have.
>

Indeed. If we make it a function and put in object.d would anyone notice 
the change?

> import std.exception;
>
> void foo(T...)(T args)
> {
>      // Compiles:
>      enforce(args);
>
>      // DOES NOT COMPILE:
>      // assert(args);
>
>      // Must expand manually:
>      assert(args[0], args[1]);
> }
>
> void main()
> {
>      foo(true, "hi");
> }
>
> Ali


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list