I am trying to compile solutions and projects on MSVC++ 10 that worked fine in MSVC++ 9, and I am having trouble with it, mostly getting the following message:
error C2888: ‘std::hash’ : symbol cannot be defined within namespace ‘tr1’
on the following code:
namespace std {
namespace tr1 {
template <>
struct hash< Rubedo::eChannelFamily >
{
std::size_t operator()( const Rubedo::eChannelFamily& Key ) const
{
return ( int ) Key;
}
};
}}
I would be perfectly happy if I could do one of the following:
- Modify the code to fix the bugs and compile cleanly;
- Force the compiler to behave like MSVC++ 9.0.
How would I do something like that?
Thank you very much in advance.
hashis in namespacestdin VS2010, as it’s part of C++0x’s Standard library, notstd::tr1. Just remove the tr1 section and the compiler should be fine.This is a fairly trivial modification of a hash I have for my own type which compiles successfully.