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

Discussion in 'C++' started by erictham115@gmail.com, Feb 21, 2007.

  1. Guest

    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
     
    , Feb 21, 2007
    #1
    1. Advertising

  2. Re: Copying a template class into another template class object withdifferent no of templates

    wrote:
    > 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
     
    John Harrison, Feb 21, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JKop
    Replies:
    3
    Views:
    481
  2. recover
    Replies:
    2
    Views:
    817
    recover
    Jul 25, 2006
  3. nw
    Replies:
    5
    Views:
    392
    Permostat
    Mar 12, 2010
  4. Shekar Ls
    Replies:
    1
    Views:
    89
    Patrick Okui
    Aug 19, 2009
  5. Sparhawk
    Replies:
    5
    Views:
    119
    Harag
    Aug 29, 2004
Loading...

Share This Page