Multiple alias for multiple functions?

Borislav Kosharov boby_dsm at abv.bg
Thu Aug 8 13:14:57 PDT 2013


I want to make a simple Vector struct class:

struct Vector {
     alias _data this;
     alias data!0 x, width;
     alias data!1 y, height;

private:
     @property float data(int i)() {
         return _data[i];
     }

     @property void data(int i)(float value) {
         _data[i] = value;
     }

     float[2] _data;
}

But I get two similar errors:
Vector.data matches more than one template declaration, 
vector.d(9):data(int i)() and vector.d(13):data(int i)(float 
value)

I see that it might cause problems to have ambiguous aliases, but 
does anyone know how I might implement this? Should I remove the 
struct and just make @property x for float[2] and the others?


More information about the Digitalmars-d mailing list