Accessing all data in TypeTupple (AliasSeq) and stringify them

Voitech via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 25 05:16:43 PST 2016


Hi, I have some code processing functions definition in compile 
time, I want to override
them in some other class but not explicitly so created this code:

template MixinFunction(alias attributes,alias returnType,alias 
name,alias parameters,alias bodyy){

	enum string MixinFunction = format(q{
			%s %s %s(%s){

				%s

			}

		},attributes,returnType,name,parameters,bodyy);
}
unittest{
	alias func=MixinFunction!("static","void","testFunc","int a,int 
b",q{

			import std.stdio;
			writeln("im void body");

		});
	pragma(msg,func);
	mixin(func);
}

Now i acquired all data like return type, parameters but need to 
turn them into string for example function parameters must have 
form of:

for function func:
void func(int a,string b){}

alias parameters=Parameters!func;

returns me AliasSeq!(int,string)
I want to to turn them into string: like "int param0, string 
param1", but in template

     template AliasSeqToString(TList...){

         enum AliasSeqToString= ... //each ?


     }
How to operate on TypeTuple/AliasSeq elemens withouth foreach ?






More information about the Digitalmars-d-learn mailing list