scaling of templates with alias argument
Frank Benoit
keinfarbton at googlemail.com
Mon May 14 13:51:08 PDT 2007
void func( alias T )(){
Stdout.formatln( "member {} {} {}",
T.offsetof,
T.stringof,
typeof(T).stringof );
}
class MyClass{
uint data1;
long data2;
void reg(){
func!(data1);
func!(data2);
}
}
With this mechanism, a template function can access the type, value and
external-scope name of the argument. But each call or func makes a new
instance of this template function.
Using such template function massively (like little text preprocessor
makros in C), will generate big binaries. Is that true?
Is there a better way?
More information about the Digitalmars-d
mailing list