www.digitalmars.com
Last update Tue Nov 14 12:05:30 2006

std.traits

Templates with which to extract information about types at compile time.

template ReturnType(alias dg)
template ReturnType(dg)
Get the type of the return value from a function, a pointer to function, or a delegate.

Example:
 import std.traits;
 int foo();
 ReturnType!(foo) x;   // x is declared as int


template ParameterTypeTuple(alias dg)
template ParameterTypeTuple(dg)
Get the types of the paramters to a function, a pointer to function, or a delegate as a tuple.

Example:
 import std.traits;
 int foo(int, long);
 void bar(ParameterTypeTuple!(foo));      // declares void bar(int, long);
 void abc(ParameterTypeTuple!(foo)[1]);   // declares void abc(long);


template FieldTypeTuple(S)
Get the types of the fields of a struct or class. This consists of the fields that take up memory space, excluding the hidden fields like the virtual function table pointer.