DefaultValue

A UDA for explicitly specifying the default value of a Property.

This UDA works with getter/setter functions. It should be attached to only one of the two functions.

The normal D default value will still be used if no @DefaultValue UDA is attached.

struct DefaultValue (
Expression...
)

Examples

{ // UDA is needed to give getter/setter functions a default value @Property @DefaultValue!5 int number() const { // ... } void number(int val) { // ... }

// plain variable; no UDA is needed @Property int simpler = 6; }

Meta