
22 Aug
2012
22 Aug
'12
5:10 a.m.
On 22 August 2012 11:49, Filip Konvička <filip.konvicka@logis.cz> wrote:
Hi,
In Boost 1.51, it looks to me like boost::hash_value no longer knows how to handle enums anymore.
Sorry, I prevented hashing by implicit casts in this release, I didn't realise it would break enum support.
Is the following the right way to tell it to treat enums like ints?
#if (BOOST_VERSION >= 105100) // Boost 1.51.0+ namespace boost { /// Enable hashing of enums. template<typename E> size_t hash_value( E const e, typename std::enable_if<std::is_enum<E>::value, E>::type def = static_cast<E>(0)) { return hash_value((int)e); } } #endif
I think that should work. I'll see if can get a portable version in trunk as soon as possible.