parameter pack to inputRange

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 9 05:36:00 PDT 2016


On 05/09/2016 03:44 AM, Dicebot wrote:

 > Ali version generates a compile-time switch for index

I think it's a run-time switch, generated by a compile-time foreach:

E front() {
     final switch (index) {                    // <-- RUNTIME
         /* static */ foreach (i, arg; Args) { // <-- COMPILE TIME
             case i:                           // <-- RUNTIME
                 return arg;                   // <-- RUNTIME
         }
     }
}

Quite confusing. :)

 > that returns either literals or external variables by
 > referencing their symbol directly.

I see. So, a parameter pack (AliasSeq) uses 'alias' template parameters 
for symbols. Makes sense...

Ali



More information about the Digitalmars-d-learn mailing list