enumerating member offsetofs via foreach over members-tuple

Denis Koroskin 2korden at gmail.com
Wed Nov 19 08:41:58 PST 2008


On Wed, 19 Nov 2008 08:12:21 +0300, deadimp <deadimp at gmail.com> wrote:

> Denis Koroskin Wrote:
>
>> On Fri, 14 Nov 2008 23:55:08 +0300, Denis Koroskin <2korden at gmail.com>
>> wrote:
>>
>> One more found, can anyone explain error message, please? Is it valid or
>> not?
>>
>> template Test()
>> {
>>      void test()
>>      {
>>          foreach (m; this.tupleof) {
>>              writefln(typeof(m).stringof); // test.d(8): function
>> test.B.Test!().test cannot access frame of function test
>>          }
>>      }
>> }
>>
>> struct A
>> {
>>      float i;
>>      mixin Test!();
>> }
>>
>> struct B
>> {
>>      A a;
>>      mixin Test!();
>> }
>
> Which compiler are you using?
> I tested this on codepad.org and it worked.

Sorry, I forgot to mention - it's 2.020



More information about the Digitalmars-d mailing list