How to partially forward properties of struct array member to struct (disable length property) ?

ParticlePeter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 6 03:44:49 PDT 2015


On Sunday, 6 September 2015 at 10:24:25 UTC, Marc Schütz wrote:
> Untested:
>
>     struct Vector(T) {
>         T[42] data;
>
>         auto opDispatch(string func, Args...)(Args args)
>         if(is(typeof(mixin("data."~func)(Args.init))) && func 
> != "length")
>         {
>             return mixin("data."~func)(Args.init);
>         }
>     }

Unfortunately not working, afaics the built in static array does 
not have the property opIndex et al. so they cannot be forwarded, 
right?


More information about the Digitalmars-d-learn mailing list