Topic: [Q] Class template specializable on a template-template-parameter?
Author: "Gabor Greif" <gabor@no.netopia.com>
Date: 1999/09/30 Raw View
Hello,
recently an interesting question came to my mind...
We all know that a class template can be specialized on one or more
parameters:
template <typename, int>
struct Foo;
template <int I>
struct Foo<int, I> { };
template <typename T>
struct Foo<T, 42> { };
etc.
Now, if Bar has a template-template-parameter, can I specialize on it too?
template <typename> class A;
template <typename> class B;
template <template <typename> class T>
struct Bar;
template <>
struct Bar<A> { };
template <>
struct Bar<B> { }; // legal C++?
I have no compiler yet to make empirical testing...
What does the standard say on this topic?
Gabor
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Gabor Greif" <gabor@no.netopia.com>
Date: 1999/08/16 Raw View
Hello,
recently an interesting question came to my mind...
We all know that a class template can be specialized on one or more
parameters:
template <typename, int>
struct Foo;
template <int I>
struct Foo<int, I> { };
template <typename T>
struct Foo<T, 42> { };
etc.
Now, if Bar has a template-template-parameter, can I specialize on it too?
template <typename> class A;
template <typename> class B;
template <template <typename> class T>
struct Bar;
template <>
struct Bar<A> { };
template <>
struct Bar<B> { }; // legal C++?
I have no compiler yet to make empirical testing...
What does the standard say on this topic?
Gabor
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]