Re: [eigen] news from the LU / rank / solving API front

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


2009/10/18 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> On Sun, Oct 18, 2009 at 6:17 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
>> Why should the destructor be virtual here? Is it important, in our
>> context, to allow referring to Derived objects as objects of the base
>> (here LU) type?
>
> Because when somebody derives and calls delete on the base class the derived
> class's destructor will not be called

I understand that there exists this extra fancy feature of virtual
base classes that makes this possible, but just because it exists
doesn't mean that everybody must do it, right? Before relying on that,
the user should check that the destructor is virtual; now the reason
why i'm a bit wary of doing that is that there are other classes of
Eigen where this isn't an option, namely in Matrix we want the sizeof
to be minimal so we don't want to add a vtable pointer here. Since I
can't make Matrix virtual, i'm wary of making other classes virtual as
that would only be a partial solution anyway for people who need that
feature, and that would require extra documentation. If there's a
specific reason why having LU virtual is specifically useful, of
course that can be considered!

Benoit



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