mirror of
https://github.com/boostorg/functional.git
synced 2025-08-03 06:24:34 +02:00
@@ -10,8 +10,8 @@ project hash-tests
|
|||||||
<warnings>all
|
<warnings>all
|
||||||
<toolset>intel:<warnings>on
|
<toolset>intel:<warnings>on
|
||||||
<toolset>intel:<cxxflags>-strict-ansi
|
<toolset>intel:<cxxflags>-strict-ansi
|
||||||
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
|
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal"
|
||||||
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
|
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal"
|
||||||
<toolset>msvc:<warnings-as-errors>on
|
<toolset>msvc:<warnings-as-errors>on
|
||||||
#<toolset>gcc:<warnings-as-errors>on
|
#<toolset>gcc:<warnings-as-errors>on
|
||||||
#<toolset>darwin:<warnings-as-errors>on
|
#<toolset>darwin:<warnings-as-errors>on
|
||||||
|
@@ -35,6 +35,10 @@ int main() {}
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <boost/limits.hpp>
|
#include <boost/limits.hpp>
|
||||||
|
@@ -30,6 +30,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
|
|
||||||
char const* float_type(float*) { return "float"; }
|
char const* float_type(float*) { return "float"; }
|
||||||
char const* float_type(double*) { return "double"; }
|
char const* float_type(double*) { return "double"; }
|
||||||
char const* float_type(long double*) { return "long double"; }
|
char const* float_type(long double*) { return "long double"; }
|
||||||
|
@@ -28,6 +28,10 @@
|
|||||||
#pragma warning(disable:4310) // cast truncates constant value
|
#pragma warning(disable:4310) // cast truncates constant value
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void numeric_test(T*)
|
void numeric_test(T*)
|
||||||
{
|
{
|
||||||
|
@@ -86,10 +86,24 @@ namespace boost
|
|||||||
{
|
{
|
||||||
namespace hash_detail
|
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>
|
template <class T>
|
||||||
inline std::size_t float_hash_value(T v)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user