On Monday, 14 July 2014 at 10:28:30 UTC, Dominikus Dittes Scherkl wrote:
Is it possible to write custom properties for basic types, so that I can write e.g. "int.myProp" instead of "myProp!int()" [analogue to x.myProp instead of myProp(x)]?

yes, just define a funciton with the first parameter int:

```d

@property int triple(int x)
{
  return x * 3;
}

void main()
{
  int x = 4;
  assert(12 == x.triple);
}
```

Reply via email to