[linux-audio-dev] templates - little bit OT

conrad berhörster conrad.berhoerster at gmx.de
Wed Jan 18 23:41:58 UTC 2006


Hello, 
maybe the c++ gurus out there have an idea. currently i think it is 
unpossible.

i try to use a template a a class member variable, like that: 
asume a template matrix class 

template < int cols, int rows> 
class matrix {
 // implementation

}

everything works fine when i'm doing something like 
matrix<<3,4> mymat; 
matrix <5,5> quad; 

but now i try to do it a little more generic i try to build a class, which 
have a member of this matrix like
class MyClass
{
  MyClass(); 
 MyClass(n,n); 
private: 
  matrix<n,n>
};   

this means, at runtime, i want to set the size of the matrix. is this 
possible? this are divers concepts (templates and runtime) , aren't they? 

thanks c~



More information about the Linux-audio-dev mailing list