Topic: c++ template classes
Author: "Sheryl A. Jennings" <jennings@cig.mot.com>
Date: 1996/08/06 Raw View
Is there a way to use a template class as a parameter to a member function of a
non-template class?
When type checking is done at compile time, the compiler complains about <T> not
being defined as a parameter to the member function of the non-template class.
Is there a way to get around that so that the type checking is actually done at
run time?
Sheryl
[ 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: fwai@armltd.co.uk (Francis Wai)
Date: 1996/08/07 Raw View
"Sheryl A. Jennings" <jennings@cig.mot.com> writes:
>Is there a way to use a template class as a parameter to a member function
>of a non-template class?
>When type checking is done at compile time, the compiler complains about <T>
>not being defined as a parameter to the member function of the non-template
>class.
If I understand your question, you're actually asking for type as value.
I do not believe C++ is into this sort of thing.
(But, if that's what you want, I can supply references to languages that
support this.)
However, the Oct-95 DWP does indicate that you can do,
template <class T> struct S {};
template <template <class T> struct SS = S> struct X { ... };
I believe the intention is that things enclosed by the angle brackets
have only compile time or static semantics, never runtime.
I could be wrong, though.
--Francis
--
e-mail: fwai@armltd.co.uk
---
[ 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 ]