Unordered/hash: Avoid a gcc warning. Refs #6771

[SVN r77832]
This commit is contained in:
Daniel James
2012-04-08 15:29:15 +00:00
parent 01aba11b87
commit 3910f072cd
5 changed files with 29 additions and 3 deletions
@@ -86,10 +86,24 @@ namespace boost
{
namespace hash_detail
{
template <class T>
inline bool is_zero(T v)
{
#if !defined(__GNUC__)
return v == 0;
#else
// GCC's '-Wfloat-equal' will complain about comparing
// v to 0, but because it disables warnings for system
// headers it won't complain if you use std::equal_to to
// compare with 0. Resulting in this silliness:
return std::equal_to<T>()(v, 0);
#endif
}
template <class T>
inline std::size_t float_hash_value(T v)
{
return v == 0 ? 0 : float_hash_impl(v);
return boost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v);
}
}
}