Hi,
I'm hoping somebody here can help me with a simple problem of template
syntax.
Here's an example:
template<typena me T, int iclass A
{
static int a;
};
template<typena me T, int iint A<T, 0>::a = 3;
Here, I'm trying to specialise T for the case where i is 0.
MSVC (8.0) reports this error on the last line: "template argument list
following class template name must list parameters in the order used in
template parameter list".
As far as I can see, the lists *do* list their parameters in the same order!
I've consulted Stroustup (2nd Ed) and the other C++ books I have, but I
can't find a similar partial specialisation example to learn from. In
simpler specialisation examples, they leave out the first parameter list
(giving just template<>), but if I do this, then T isn't recognised
later on in the same line. If I give "typename T" but omit "int i", then
the compiler says I have too few template parameters for T.
What's the proper syntax for this particular kind of specialisation?
Many thanks to anyone who can assist.
--
Paul Roberts
I'm hoping somebody here can help me with a simple problem of template
syntax.
Here's an example:
template<typena me T, int iclass A
{
static int a;
};
template<typena me T, int iint A<T, 0>::a = 3;
Here, I'm trying to specialise T for the case where i is 0.
MSVC (8.0) reports this error on the last line: "template argument list
following class template name must list parameters in the order used in
template parameter list".
As far as I can see, the lists *do* list their parameters in the same order!
I've consulted Stroustup (2nd Ed) and the other C++ books I have, but I
can't find a similar partial specialisation example to learn from. In
simpler specialisation examples, they leave out the first parameter list
(giving just template<>), but if I do this, then T isn't recognised
later on in the same line. If I give "typename T" but omit "int i", then
the compiler says I have too few template parameters for T.
What's the proper syntax for this particular kind of specialisation?
Many thanks to anyone who can assist.
--
Paul Roberts
Comment