Template member function templates
Classes can have member function templates. These member templates can be explicit specialized. For example:
struct Foo
{
template <typename T>
void f()
{
}
};
template <>
inline void Foo::f<int>()
{
// full specialization
}
It seems that Visual Studio 2019 allows for an illegal syntax with the full specialization declaration in the class itself:struct Foo
{
template <typename T>
void f();
// illegal?
template <>
void Foo::f<int>();
};
template <>
void Foo::f<int>()
{
}
Also the inline specifier isn't necessary then in Visual Studio without running into errors with duplicate symbols.
No comments:
Post a Comment