How to enumerate a sequence?

Victor Porton porton at
Wed Feb 27 13:15:06 UTC 2019

.enumerate does not work for compile-time sequences. Consider for 
the sake of discussion the following nonsense (I know it cannot 
be done without enumerate) code:

import std.meta;
import std.range;

string join(Fields...)() {
   enum f(size_t i) = __traits(identifier, Fields[i]);
   return staticMap!f(Fields.enumerate).join('\n'); // does not 
compile because of .enumerate

void main(string[] args)
     string r = join!(int, float)();

How to make it compile?

More information about the Digitalmars-d-learn mailing list