No TypeTuple expansion for assert?

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 4 09:07:59 PDT 2014


On 10/03/2014 09:08 PM, Ali Çehreli wrote:
> I know that assert is not a function but it would be nice to have.
>
> 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

It should just auto-expand. There is no reason for it not to. Same for 
static assert.


More information about the Digitalmars-d mailing list