Re: [eigen] Inheritence

[ Thread Index | Date Index | More Archives ]

note that in the devel branch you can do something much better: inherit DenseMatrixBase instead of Matrix. This way YourType inherit MatrixBase<YourType> and not MatrixBase<Matrix> that is much better and safer. For instance if you need different traits than Matrix. Also calling .derived() on a MatrixBase<Derrived> will return a YourType instead of a Matrix object, etc.


On Fri, Feb 5, 2010 at 9:02 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
You would for example have to if some function taking a T& tried to
use ei_traits<T>::Flags, and then you pass an object of your derived
class to that function.

However, I can't think of a valid case for a function to do that.
Instead of using ei_traits<T>::Flags, it should use T::Flags. So if
you remember what triggered a compilation error when not specializing
ei_traits, please tell me.

ei_traits is only there as a forward-declaration trick for CRTP
classes. It is only an internal device.


2010/2/5 Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>:
> Well actually, i remember that in some cases i needed to define the ei_traits (i have it in a #if 0/#endif in my code), but i couldn't say which case :/..... just that right now, i dont need for my use case
> Thomas
> --
> Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
> In data venerdì 05 febbraio 2010 08:02:52, Benoit Jacob ha scritto:
>> MyMatrix inherit Matrix which inherits MatrixBase<Matrix>.
>> So whenever an object of class MyMatrix is seen as a MatrixBase, it is
>> a MatrixBase<Matrix> so it uses ei_traits<Matrix>.
>> Interesting!
>> So, forget my recommendation about ei_traits.

Mail converted by MHonArc 2.6.19+