Topic: Templates using other templates
Author: Pete Becker <petebecker@acm.org>
Date: 1997/11/01 Raw View
Mark Wallace wrote:
>
> Is there a way to define a template class which uses a second template class
> and have them use a common template argument (see example below)?
>
> Thanks Mark
>
> template<class T>
> class Template1
> {
> public:
> Template1 ( Template2<T>& Var );
> ...
> ..
Yes. Just do it. If you remove the ...'s from the above code, add a
closing {;, and put the definition of Template2 ahead of the definition
of Template1, it should compile just fine. Did you try this?
-- Pete
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: "Mark Wallace" <mark_wallace@lotus.com>
Date: 1997/10/31 Raw View
Is there a way to define a template class which uses a second template class
and have them use a common template argument (see example below)?
Thanks Mark
template<class T>
class Template1
{
public:
Template1 ( Template2<T>& Var );
...
..
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]