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;
- 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)); void abc(ParameterTypeTuple!(foo)[1]);
- 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.