On Friday, 18 September 2020 at 18:43:38 UTC, H. S. Teoh wrote:
Why can't you return by ref, which would also avoid the copying?

        ref S foo(return ref S s) { return s; }

Compiler errors out:
onlineapp.d(9): Error: function onlineapp.foo(return ref S s) is not callable using argument types (S) onlineapp.d(9): cannot pass rvalue argument S() of type S to parameter return ref S s


Reply via email to