Remove <boost/container_hash/hash.hpp>

This commit is contained in:
Matt Borland
2021-03-14 14:37:17 +03:00
parent bb43abeb6e
commit 2aed2edf7f
3 changed files with 35 additions and 5 deletions

View File

@@ -9,11 +9,12 @@
#include <iostream>
#include <sstream>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cmath>
#include <cstdint>
#include <boost/multiprecision/number.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/container_hash/hash.hpp>
namespace boost {
namespace multiprecision {
@@ -201,7 +202,7 @@ inline int eval_fpclassify(const number_backend_float_architype& arg)
inline std::size_t hash_value(const number_backend_float_architype& v)
{
boost::hash<long double> hasher;
std::hash<long double> hasher;
return hasher(v.m_value);
}

View File

@@ -0,0 +1,29 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright 2021 Matt Borland. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MULTIPRECISION_DETAIL_HASH_COMBINE_HPP
#define BOOST_MULTIPRECISION_DETAIL_HASH_COMBINE_HPP
#include <cstddef>
#include <functional>
namespace boost { namespace multiprecision { namespace detail {
inline void hash_combine(std::size_t& seed)
{
(void)seed; // suppress warning: unused parameter 'seed'
}
template <typename T, typename... Args>
inline void hash_combine(std::size_t& seed, const T& v, Args... args)
{
std::hash<T> hasher;
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
hash_combine(seed, args...);
}
}}} // Namespaces
#endif // BOOST_MULTIPRECISION_DETAIL_HASH_COMBINE_HPP

View File

@@ -15,7 +15,7 @@
#include <boost/multiprecision/detail/number_compare.hpp>
#include <boost/multiprecision/traits/is_restricted_conversion.hpp>
#include <boost/multiprecision/traits/is_complex.hpp>
#include <boost/container_hash/hash.hpp>
#include <boost/multiprecision/detail/hash_combine.hpp>
#include <istream> // stream operators
#include <cstdio> // EOF
#include <cctype> // isspace
@@ -2162,7 +2162,7 @@ template <class T, multiprecision::expression_template_option ExpressionTemplate
inline BOOST_MP_CXX14_CONSTEXPR std::size_t hash_value(const rational<multiprecision::number<T, ExpressionTemplates> >& val)
{
std::size_t result = hash_value(val.numerator());
boost::hash_combine(result, hash_value(val.denominator()));
boost::multiprecision::detail::hash_combine(result, hash_value(val.denominator()));
return result;
}
@@ -2195,7 +2195,7 @@ struct hash<boost::rational<boost::multiprecision::number<Backend, ExpressionTem
BOOST_MP_CXX14_CONSTEXPR std::size_t operator()(const boost::rational<boost::multiprecision::number<Backend, ExpressionTemplates> >& val) const
{
std::size_t result = hash_value(val.numerator());
boost::hash_combine(result, hash_value(val.denominator()));
boost::multiprecision::detail::hash_combine(result, hash_value(val.denominator()));
return result;
}
};