alias function this - limitations

Simen kjaeraas simen.kjaras at gmail.com
Thu Jun 24 05:52:29 PDT 2010


struct Ref( T ) {
   T* payload;
   @property ref T getThis( ) {
     return *payload;
   }
   @property ref T getThis( ref T value ) {
     payload = &value;
     return *payload;
   }
   alias getThis this;
}

void bar( ) {
   Ref!int f;
   int n;
   f = n;
   int b = f;
}

This code fails on the line 'int b = f;'. Is it supposed to?

-- 
Simen


More information about the Digitalmars-d-learn mailing list