Copying a template class into another template class object with different no of templates

Copying a template class into another template class object with different no of templates

Post by erictham11 » Thu, 22 Feb 2007 14:50:55


hi

Suppose i have a template class
template <class V, class I=int, class S=FullMatrix<V> > where the
FullMatrix is another template object.
class matrix

I will like to either create a constructor or add a function which
copies from another template class with only
template<class V>
class matrixsub

such that a new matrix object is created.

The class I and S can be populated by default types.

Does anyone know how to do it? I am a loss how to start in the 1st
place, so do not have any sample code.

Eric
 
 
 

Copying a template class into another template class object with different no of templates

Post by John Harri » Thu, 22 Feb 2007 14:58:52


You mean this? I'm not quite sure from your description.

template <class V, class I=int, class S=FullMatrix<V> >
class matrix
{
public:
matrix(const matrixsub<V>& s);
...
};

john