On Wednesday, 12 December 2012 at 22:58:47 UTC, Max Samukha wrote:
On Wednesday, 12 December 2012 at 22:19:54 UTC, js.mdnq wrote:
Also, I initially tried to do

        B!(A.b1.offsetof) b1;

a'la

http://forum.dlang.org/thread/mailman.2627.1355335532.5162.digitalmar...@puremagic.com

but dmd 2.060 crashes, which is why I moved on to using a static if.

That's 'outer', yet another half-done D feature. It should be implemented for nested structs.

Half done? Has it even been implemented at all?

In any case my method seems to provide a solution to the problem in the mean time. I have updated the code to work correct(had a small bug) and it uses an alias to make it easier to update in the future if D finally does support this construct in full.

http://dpaste.dzfl.pl/64025e0a

If outer is the appropriate keyword then Parent can easily be changed. Little would have to be done to the structs to make it work. In fact, the method should work if D ever decides to support such a feature with little change. Compile times could be increased though by removing the templating, but unfortunately that might require a lot of work. A mixin might simplify it.

Reply via email to