K
Kalle Rutanen
Hello
Assume this template class has been defined:
template <typename T>
class A
{
public:
void f();
};
Assume I want to define f only for type int. I found my compiler (VC++7)
accepts all of the following combinations (there are 4) for the explicit
specialization:
// The following is optional.
template <typename T>
void A<T>::f();
// In the following, template <> is optional
template <>
void A<int>::f()
{
}
Are all of the combinations standard-conforming ?
In particular, does the standard allow that in the latter we write
template <> without defining the general case for type T ?
Assume this template class has been defined:
template <typename T>
class A
{
public:
void f();
};
Assume I want to define f only for type int. I found my compiler (VC++7)
accepts all of the following combinations (there are 4) for the explicit
specialization:
// The following is optional.
template <typename T>
void A<T>::f();
// In the following, template <> is optional
template <>
void A<int>::f()
{
}
Are all of the combinations standard-conforming ?
In particular, does the standard allow that in the latter we write
template <> without defining the general case for type T ?