Two way struct wrapper
Igor
stojkovic.igor at gmail.com
Fri Oct 13 09:06:39 UTC 2017
On Wednesday, 11 October 2017 at 12:35:51 UTC, drug wrote:
> Using `alias this` it's easy to make wrapper for structure that
> calls wrapped structure methods like its own. This is one way -
> from wrapper to wrapped transformation. Is it possible to
> create the opposite way from wrapped to wrapper?
>
> https://run.dlang.io/is/Avyu3I
>
> All calls to Bar is redirected to Foo, but output of Foo is not
> redirected to Bar.
I don't see how compiler can just deduce that... In either case
you can just wrap the expression with another Bar():
auto v5 = Bar(Bar(Foo(2)) + Bar(Foo(3)));
More information about the Digitalmars-d-learn
mailing list