This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with template template parameter


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Unfortunatelly it's no solution. The reason:

A Matrix<rows,1> can also be handled as a Vector.
A Matrix<1,1> is just a floating point number.

This specializations need to be handled and I wanted to avoid rewriting
the same code multiple times (through using a base-class).

	CU
	Alexander

Eljay Love-Jensen wrote:
| Hi Alexander,
|
| Hmmm, Oliver must be on to something there!  The intricacies of templates.
|
| Is this an option for your problem domain...
|
| template<int rows, int cols>
| class Matrix {
| public:
|     Matrix() {
|         cout << __PRETTY_FUNCTION__ << endl;
|         }
|
|     template<int cols2>
|     Matrix<rows, cols2>* operator * (Matrix<cols, cols2>& lhs) {
|         cout << __PRETTY_FUNCTION__ << endl;
|         }
|
|     };
|
| Gets rid of having a Matrix_Base, which avoids the specialization issue
| you bumped into.
|
| --Eljay
|
| PS:  Thanks for __PRETTY_FUNCTION__ ... I was not aware of it before!

My pleasure :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9/fbBdcrm1qkhaakRAqyeAKCYz5SmjoRzlJWbwk7F3VfjnsUDsgCcDUge
bog1/j70bGLM5RhSu6FRJiI=
=tKTM
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]