templatized matrix system with inheritance

Started by
13 comments, last by Zahlman 16 years, 2 months ago
Quote:Original post by Enalis
Mawww, I had them in as typedefs, but then I read typedef's for templates are bad.
Hm, what was the reference? Sounds like either it's a poor reference, or whatever the message was supposed to be was 'lost in translation', so to speak.

Anyway, typedef's are not only appropriate, but recommended (arguably even necessary) when working with heavily templated code.

[Oops, looks like maybe you were referring to templated typedefs...]
Advertisement
Man, I was hoping to have a nice self contained solution, not have a lot of helpers, I'll keep working and if I get anywhere the idea is to put the code up on my site anyway. Thanks for all the help so far.

http://www.element-games.com/palodequeso
Douglas Eugene Reisinger II
Projects/Profile Site
A quick heads up, I feel like an amature, however I forgot that classes in c++ do not inherent the constructors, which I forgot to re-write. So I'm going back through and adding in all of the right constructors, however, when i tested this out before when it wasn't in my engine yet, it seemed to be allocating the right memory. Who knows.
Douglas Eugene Reisinger II
Projects/Profile Site
The final verdict seems to be, to create three separate implementations without using inheritance but keeping the templates.

so now it will be

template <class Type, int size> class SquareMatrix{ /* stuff */ }
template <class Type, int size> class ColumnVector{ /* stuff */ }
template <class Type> class Transformation{ /* stuff */ }

thoughts?
Douglas Eugene Reisinger II
Projects/Profile Site
Quote:Original post by Enalis
Man, I was hoping to have a nice self contained solution, not have a lot of helpers, I'll keep working and if I get anywhere the idea is to put the code up on my site anyway. Thanks for all the help so far.

http://www.element-games.com/palodequeso


Helpers often improve encapsulation. The natural C++ unit of "containment" for "solutions" is the translation unit, not the class.

This topic is closed to new replies.

Advertisement