aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/boost/files/hash_enums.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2012-09-27 20:40:42 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-28 11:24:13 +0100
commit139b65affbf50c4230e344cd4d0205ef025bb7c3 (patch)
treeb74f37420f5cff6a6a8245e5b25f2e0c86ebfa41 /meta/recipes-support/boost/files/hash_enums.patch
parent536c9e42d316efb42651fdc2eba1b8548d74329d (diff)
downloadopenembedded-core-contrib-139b65affbf50c4230e344cd4d0205ef025bb7c3.tar.gz
openembedded-core-contrib-139b65affbf50c4230e344cd4d0205ef025bb7c3.tar.bz2
openembedded-core-contrib-139b65affbf50c4230e344cd4d0205ef025bb7c3.zip
boost: Support enums in hash
Fixes builds which were building fine with previous versions of boost Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/boost/files/hash_enums.patch')
-rw-r--r--meta/recipes-support/boost/files/hash_enums.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/recipes-support/boost/files/hash_enums.patch b/meta/recipes-support/boost/files/hash_enums.patch
new file mode 100644
index 0000000000..368da962c1
--- /dev/null
+++ b/meta/recipes-support/boost/files/hash_enums.patch
@@ -0,0 +1,45 @@
+Allow hashing of enums.
+Fixes errors like
+
+/opt/poky/1.3.0-1/sysroots/i586-poky-linux/usr/include/boost/functional/hash/extensions.hpp:257:34: error: no matching function for call to 'hash_value(const myspace::idx&)'
+
+Upstream-Status: Pending
+Singed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: boost_1_51_0/boost/functional/hash/hash.hpp
+===================================================================
+--- boost_1_51_0.orig/boost/functional/hash/hash.hpp 2012-07-15 16:28:30.000000000 -0700
++++ boost_1_51_0/boost/functional/hash/hash.hpp 2012-09-26 14:00:57.738364002 -0700
+@@ -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>
+@@ -89,6 +91,9 @@
+ typename boost::hash_detail::long_numbers<T>::type hash_value(T);
+ 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&);
+@@ -178,7 +183,12 @@
+ {
+ 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)