Consider this overly simple test:
class foo
{
public:
foo(int i);
template< typename T > foo(T);
};
template<> foo::foo(int i) {}
Now, GCC is happy to accept this when compiling, but the RVCT compiler issues an error:
test.cpp", line 11: Error: #792: "foo::foo(int)" is not an entity that can be explicitly specialized
template<> foo::foo(int i) {}
Barring the issue of "why would you want to do this", is this legal C++ (from an academic point of view?)
Thanks in advance
You are attempting to do an explicit specialization of template<typename T> foo(T) where T=int.
Did you actually want this?
template<typename T> foo::foo(T) {
}
--- EDIT ---
Just to make it clear: "explicit specialization" is legal in C++, but apparently your compiler does not support it (on individual methods anyway, maybe it does on whole classes?).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With