Re: opDispatch with string mixin does not work as I would expect.

2018-02-10 Thread German Diago via Digitalmars-d-learn
On Saturday, 10 February 2018 at 07:47:58 UTC, Nicholas Wilson wrote: On Saturday, 10 February 2018 at 06:32:43 UTC, German Diago Alternatively you could do something like auto opDispatch(string name)() if(hasMember!(HeaderData,name){ readHeader(); return

Re: opDispatch with string mixin does not work as I would expect.

2018-02-09 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 10 February 2018 at 06:32:43 UTC, German Diago wrote: Hello everyone, I am trying to forward some member functions from a struct as a Catch-all function, so I did something like this: struct A { struct HeaderData { align(1): char [21] id;

Re: opDispatch with string mixin does not work as I would expect.

2018-02-09 Thread Boris-Barboris via Digitalmars-d-learn
On Saturday, 10 February 2018 at 06:32:43 UTC, German Diago wrote: The mixin line does not work. I want to generate the access to the field. How could I achieve that? struct Outer { struct Inner { int a; float b; } Inner i;

opDispatch with string mixin does not work as I would expect.

2018-02-09 Thread German Diago via Digitalmars-d-learn
Hello everyone, I am trying to forward some member functions from a struct as a Catch-all function, so I did something like this: struct A { struct HeaderData { align(1): char [21] id; ubyte field1; ubyte field2; }