On Wednesday, 6 July 2016 at 09:08:11 UTC, zodd wrote:
So, I've created a simple wrapper template to achieve what I
want. It reminds me of the C++ - a bunch of additional code to
solve a simple problem (which shouldn't be an issue at all).
I'm a newbie in D thus I could do something wrong or
nonoptimal. Please, criticize my code:
http://pastebin.com/XTtXaTAR
A basic idea is to return a wrapper, which can, in turn, call
getter/setter functions.
Nice work.
Personally, I'd do it this way: http://pastebin.com/38n0fEtF
This way:
- instead of 4 pointers (2 per delegate), the wrapper only
contains 1 pointer;
- once written, it only requires one line per property to be used;
- it creates many more instantiations, which may be a Bad
Thing(tm).