[eigen] DenseCoeffsBase

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


Hi,

This is to explain the group of commits that I just made in the dev branch.

maybe you remember, not long ago, i was playing with the idea of
adding a DenseDirectAccessBase class, then gave up... well the idea is
back and this time I believe it's correctly implemented. See class
DenseCoeffsBase.

Here's a quick rationalization:

We used to have a lot of methods in DenseBase that only made sense in
the DirectAccess case. Like coeffRef(), writePacket(), copyCoeff(),
all the strides API...

That was bad of course (not to mention dangerous as they were trying
to call a method with same name in the derived class).

The "obvious" fix was to use enable_if on these methods, however
 - that would have been fiddling with their prototypes: better avoid
that if we can
 - a lot of methods were concerned, not just 1 or 2 methods.

The alternative of using a static assert was not very good here,
because e.g. operator() was overloaded with one variant using direct
access and not the other, so we'd be having issues with overload
resolution.

So instead, the idea is to introduce a new base class DenseCoeffsBase
in the hierarchy, implementing a "group enable_if". The methods
prototypes stay the same, they just move to the new base class.

Tell me if you have an objection against that.

Benoit



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