The object operator
puming via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 13 23:36:41 PDT 2015
On Friday, 14 August 2015 at 04:17:25 UTC, TheHamster wrote:
>
> assert(@@myObj.Do(3).Do(@).Do(@2) == 9);
>
If what you want is to omit the object during the call chain, you
can use with statement to mimic this feature, though not as
compact as you suggested:
```
import std.stdio;
class MyClass {
int run(int x) { return x + 2; }
}
void main() {
auto ob = new MyClass();
int res;
with (ob) {
run(3);
run(4);
run(5);
}
}
```
More information about the Digitalmars-d
mailing list