First of all I'm very sorry for the question title, but it's very hard to describe.
What of those two below is valid syntax if I want to specialized Resolve
for all instantiation of A
?
1)
template<uint32_t I> struct A {};
template<typename> struct Resolve;
template<uint32_t I>
struct Resolve<A<I>>
{
void f() { printf("im here!\n"); }
};
2)
template<uint32_t I> struct A {};
template<typename> struct Resolve;
template<>
template<uint32_t I>
struct Resolve<A<I>>
{
void f() { printf("im here!\n"); }
};
Or is template<>
optional? There's two different answers on SO: here and here.
Also please provide quotation of the standard if possible.
Option 2) doesn't compile on MSVC, but does compile at least on some versions of GCC.