Re: [eigen] private copy ctors

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2009/12/14 Björn Piltz <bjornpiltz@xxxxxxxxxxxxxx>

Finally, can somebody please enlighten me, why it is not possible to create an assignment operator for classes with const members? To me it seems sane and the following code compiles perfectly over here:

struct Foo
{
  Foo() : i(5) {}
  const int i;
};

void main ()
{
  Foo a;
  Foo b = a;
}
I can't say if that's sane or not, but the only reason that it compiles is that the assignment operator is never called. The compiler your code with "Foo b(a);". The following does not compile with MSVC:
void main ()
{
  Foo a;
  Foo b;
  if(true)
 b = a;
}


You are totally right. As I said - no idea where my mind is right now.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/