possible "solution" for ufcs

Torarin torarind at gmail.com
Mon Jun 6 12:39:18 PDT 2011


2011/6/6 KennyTM~ <kennytm at gmail.com>:
> Maybe better
>
>    auto ref opDispatch(string name, T...)(auto ref T args) {
>        mixin("return ." ~ name ~ "(this, args);");
>    }
>
> so that ref-returns and ref-parameters can be handled as well. Doesn't work
> for 'lazy' though. It also cannot preserve 'pure'-ity, 'nothrow'-ness and
> '@safe'-ty of the original function.
>
>

As far as I understand, auto ref is supposed to mean "always ref, and
accept r-values". So we would need to allow tuples to contain ref
types and construct it from the target function.

Torarin


More information about the Digitalmars-d mailing list