"This for <member> needs to be type <class>, not type <otherclass>"

Simen Kjaeraas simen.kjaras at gmail.com
Fri May 2 09:38:40 PDT 2008


While playing around with templates and alias parameters, I got the die of trying this:

struct foo(alias T)
{
  typeof(T) opAddAssign(typeof(T) rhs)
  {
    return T += rhs;
  }
}

class bar
{
private:
  int _baz;
public:
  foo!(_baz) baz;
}

When compiling this, I get the message "Error: this for_baz needs to be type bar not type foo!(_baz)*"

Is there a workaround to this, or even a plan to make such things possible in the future?

-- Simen


More information about the Digitalmars-d-learn mailing list