Re: Member function forwarding

2022-02-18 Thread Stanislav Blinov via Digitalmars-d-learn
On Thursday, 17 February 2022 at 21:17:02 UTC, Andrey Zherikov wrote: On Thursday, 17 February 2022 at 20:59:43 UTC, Andrey Zherikov wrote: Another question: does `auto foo(ARGS...)(ARGS args) { return a.foo(args); }` correctly forward `ref`, `const` etc. arguments? Actually the answer is

Re: Member function forwarding

2022-02-17 Thread Andrey Zherikov via Digitalmars-d-learn
On Thursday, 17 February 2022 at 20:59:43 UTC, Andrey Zherikov wrote: Another question: does `auto foo(ARGS...)(ARGS args) { return a.foo(args); }` correctly forward `ref`, `const` etc. arguments? Actually the answer is `NO`. I have to do `auto foo(ARGS...)(auto ref ARGS args) { return

Member function forwarding

2022-02-17 Thread Andrey Zherikov via Digitalmars-d-learn
I have a struct that has struct data member and I'd like to forward some (not all) functions from internal data member. Some thing like this: ```d struct A { void foo() const { writeln("A.foo"); } } struct B { A a; auto foo(ARGS...)(ARGS args) { return a.foo(args); } // alias