www.digitalmars.com         C & C++   DMDScript  

c++ - member template assignment operator

template<typename T>
struct B
{
  template<typename V>
  void operator =(V v)
  {
    t = v;
    // Error: need explicit cast to convert
    // from: B<int >
    // to  : int 
  }

  T t;
};

int main()
{
  B<int> b;
  b = 1;

  return 0;
}


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Dec 14 2002