KennyTM~ wrote:
>
> 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.

Yes, but this is an unresolved problem of the language in general. We can have 
the
template mixin just mixin all 8 versions with different template constraints 
until
that gets fixed (thats what will be done anyways, at least purity is reflected 
in
the mangled name AFAIK). The most important feature needed to make it work
correctly, "auto ref" is already there.


Timon

Reply via email to