- FA
alias FA = FunctionAttribute
Undocumented in source.
- Properties
alias Properties = withDefaults!(AliasPack!(Props), PropertyDefaults)
Undocumented in source.
- XA
alias XA = ExtendedFunctionAttribute
Undocumented in source.
- appendParameter
alias appendParameter(NewParameter...) = insertParameter!(arity, NewParameter)
Undocumented in source.
- insertParameter
alias insertParameter(int Position, NewParameter...) = setParameters!(parameters[0..Position], NewParameter, parameters[Position..$])
Undocumented in source.
- parameters
alias parameters = parameterList.Unpack
Undocumented in source.
- setBody
alias setBody(string newBody) = setBody_!(["{", newBody, "}"])
- setParameters
alias setParameters(NewParameters...) = Function!(aliasSeqReplace!(Property.parameterList, ParameterList!(NewParameters), Properties))
Undocumented in source.
- udas
alias udas = udaList.Unpack
Undocumented in source.
struct small;
pure int add(@small int a, @small int b) { return a + b; }
static assert(Function!add.isPure);
static assert(Function!add.isNothrow);
static assert(Function!add.isNogc);
static assert(Function!add.parameters.length == 2);
static assert(is(Function!add.parameters[0].type.origin == int));
static assert(Function!add.parameters[0].UDAs.length == 1);
static assert(is(Function!add.parameters[0].UDAs[0].origin == small));
pure int f() { return 42; }
template plus1(alias F)
{
alias NewFunction = Function!(f, "F").setName!"plus1".setBody!("return F() + 1;");
static assert(
NewFunction.mixture ==
"pure nothrow @safe @nogc std.traits.ReturnType!(F) plus1() { return F() + 1; }");
mixin(NewFunction.mixture);
}
Assert.equal(plus1!f, 43);
Meta-class Function