enumerating member offsetofs via foreach over members-tuple

deadimp deadimp at gmail.com
Tue Nov 18 21:12:21 PST 2008


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.



More information about the Digitalmars-d mailing list