How to pass default arguments in a compile time sequence?

Victor Porton porton at narod.ru
Fri Mar 1 17:55:50 UTC 2019


I have a string mixin, such that

mixin StructParams!("S", int, "x", float, "y");

creates

struct S {
   struct Regular {
     int x;
     float y;
   }
   struct WithDefaults {
     Nullable!int x;
     Nullable!float y;
   }
}

Now I want to enhance StructParams to be able to pass default 
initializers (like `float y = 2.1;`). What "format" for the 
template arguments would you suggest to be able to either pass or 
not to pass default initializers (like 2.1) for each of the 
fields of the structs?


More information about the Digitalmars-d mailing list