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

E

erictham115

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
 
J

John Harrison

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top