On Sunday, 21 May 2017 at 00:33:30 UTC, Vittorio Romeo wrote:
    auto bar(T)(T x) @nogc

Make that `scope T x` and it will compile, using stack allocation. Only worry is that you must not escape a reference to the delegate; you are only allowed to use it in that function's scope.

What are your thoughts? Has something similar been proposed before?

It has, and I actually don't hate it, but I also don't think it is necessary because of the `scope` storage class being one option and just manually writing out the struct functor being another viable one. The c++ syntax sugar is nice, but I can live without it.

Reply via email to