Fix hash_value() issue in boost-1.51.0

This commit is contained in:
adam 2012-08-31 12:20:56 +00:00
parent 2048861ce2
commit 9238400dfa
3 changed files with 45 additions and 2 deletions

View file

@ -1,9 +1,11 @@
# $NetBSD: Makefile,v 1.20 2012/02/29 14:22:23 hans Exp $
# $NetBSD: Makefile,v 1.21 2012/08/31 12:20:56 adam Exp $
BOOST_PACKAGE= headers
BOOST_COMMENT= (build-time headers)
BOOST_CONFIG= generate
PKGREVISION= 1
PKG_DESTDIR_SUPPORT= user-destdir
.include "../../meta-pkgs/boost/Makefile.common"

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.47 2012/08/27 08:49:08 adam Exp $
$NetBSD: distinfo,v 1.48 2012/08/31 12:20:56 adam Exp $
SHA1 (boost_1_51_0.tar.bz2) = 52ef06895b97cc9981b8abf1997c375ca79f30c5
RMD160 (boost_1_51_0.tar.bz2) = e92733c82785a38049f2d6a8126eadd3f8ac0c40
@ -14,4 +14,5 @@ SHA1 (patch-aq) = e5c7b72ffa2942ce401f3d9bf05498fd761df17a
SHA1 (patch-ar) = 2fec2c51272cc4ee376e6538d8f1fd8561a7f0a3
SHA1 (patch-boost_foreach.hpp) = 7cd26c4983873bcac284ad400950e341c559f9a8
SHA1 (patch-boost_foreach_fwd.hpp) = 5accd68d559213a9677f7d1204e72dd082a42a41
SHA1 (patch-boost_functional_hash_hash.hpp) = 343a1201f6e0edf46471f28c09f2997dc7fb7ba0
SHA1 (patch-libs_filesystem_src_unique_path.cpp) = 3666663305bba85871f2ef291dc117158c678643

View file

@ -0,0 +1,40 @@
$NetBSD: patch-boost_functional_hash_hash.hpp,v 1.1 2012/08/31 12:20:56 adam Exp $
Allow hashing enums.
--- boost/functional/hash/hash.hpp.orig 2012-07-15 23:28:30.000000000 +0000
+++ boost/functional/hash/hash.hpp
@@ -15,6 +15,8 @@
#include <boost/functional/hash/detail/hash_float.hpp>
#include <string>
#include <boost/limits.hpp>
+#include <boost/type_traits/is_enum.hpp>
+#include <boost/utility/enable_if.hpp>
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#include <boost/type_traits/is_pointer.hpp>
@@ -90,6 +92,10 @@ namespace boost
template <typename T>
typename boost::hash_detail::ulong_numbers<T>::type hash_value(T);
+ template <typename T>
+ typename boost::enable_if<boost::is_enum<T>, std::size_t>::type
+ hash_value(T);
+
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const&);
#else
@@ -179,6 +185,13 @@ namespace boost
return hash_detail::hash_value_unsigned(v);
}
+ template <typename T>
+ typename boost::enable_if<boost::is_enum<T>, std::size_t>::type
+ hash_value(T v)
+ {
+ return static_cast<std::size_t>(v);
+ }
+
// Implementation by Alberto Barbati and Dave Harris.
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const& v)