Template sequence parameter and default value

Ali Çehreli acehreli at yahoo.com
Thu Jan 27 16:32:19 UTC 2022


On 1/26/22 18:49, Andrey Zherikov wrote:

 > I want something like this:
 > ```d
 > void foo(MODULES... = __MODULE__)() {}

Two other options:

1)

void foo(MODULES_...)() {
   static if (MODULES_.length == 0) {
     import std.meta : AliasSeq;
     alias MODULES = AliasSeq!__MODULE__;

   } else {
     alias MODULES = MODULES_;
   }
}

2)

void foo(MODULES_...)() {
}

void foo() {
   return foo!__MODULE__;
}

Ali



More information about the Digitalmars-d-learn mailing list