I was just over specializing std::hash
for a user-defined type using:
template<>
struct hash<...> {...};
When VC10 greeted me with the warning:
warning C4099: 'std::hash<_Kty>': type name first seen using 'class' now seen using 'struct'
and I found out that its standard library declares std::hash
as class
, whereas the standard (or the latest free draft I have) declares it as struct
.
Well, of course I know that a struct isn't any different from a class (except for the different default access and inheritance types). But my questions are:
- Does VC10 violate the standard here or is it free to exchange
struct
s forclass
s in any standard library components (as long as the required access types for members stay consistent, of course)? - Is it legal to specialize a template class as a struct and vice versa or does this bring problems with name resolution and the like (at least VC10 thinks it's worth a warning).