Boost logo

Ublas :

From: Dima Sorkin (dsorkin_at_[hidden])
Date: 2005-08-11 04:43:33


Quoting Hirotaka Niitsuma <hirotaka.niitsuma_at_[hidden]>:
> I'm trying to use matrix size of c_matrix as template parameters?
> Such as:
> typedef c_matrix<float, 10,20> my_mat_type;
> template<typename MAT_TYPE>
> class myMatMethod
> {
> template<int N = MAT_TYPE::size1() ,int M = MAT_TYPE::size2() >

What you need is partial specialization of the template, which looks like

template<typename T,unsigned M,unsigned N>
class your_class<c_matrix<T,M,N> >
{ .... have T,M,N in this scope ...
};

In case of template function you will need partial overloading.

Please search about these items in the internet.
( for example
http://www.gotw.ca/gotw/049.htm
)

Regards,
 Dima.