diff options
author | Khem Raj <raj.khem@gmail.com> | 2012-09-27 20:40:42 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-28 15:19:39 +0100 |
commit | 574d72803ccaf7ea4cecc50a42f562b62f870119 (patch) | |
tree | cbb417c08d81495c0443a70f29294ed39aa334d2 /meta/recipes-support/boost/files/hash_enums.patch | |
parent | 7c6d679de0a8341ad7eefe06e05e0d1ed056074c (diff) | |
download | poky-574d72803ccaf7ea4cecc50a42f562b62f870119.tar.gz |
boost: Support enums in hash
Fixes builds which were building fine with previous versions of boost
(From OE-Core rev: 139b65affbf50c4230e344cd4d0205ef025bb7c3)
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.patch | 45 |
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 @@ | |||
1 | Allow hashing of enums. | ||
2 | Fixes errors like | ||
3 | |||
4 | /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&)' | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | Singed-off-by: Khem Raj <raj.khem@gmail.com> | ||
8 | |||
9 | Index: boost_1_51_0/boost/functional/hash/hash.hpp | ||
10 | =================================================================== | ||
11 | --- boost_1_51_0.orig/boost/functional/hash/hash.hpp 2012-07-15 16:28:30.000000000 -0700 | ||
12 | +++ boost_1_51_0/boost/functional/hash/hash.hpp 2012-09-26 14:00:57.738364002 -0700 | ||
13 | @@ -15,6 +15,8 @@ | ||
14 | #include <boost/functional/hash/detail/hash_float.hpp> | ||
15 | #include <string> | ||
16 | #include <boost/limits.hpp> | ||
17 | +#include <boost/type_traits/is_enum.hpp> | ||
18 | +#include <boost/utility/enable_if.hpp> | ||
19 | |||
20 | #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) | ||
21 | #include <boost/type_traits/is_pointer.hpp> | ||
22 | @@ -89,6 +91,9 @@ | ||
23 | typename boost::hash_detail::long_numbers<T>::type hash_value(T); | ||
24 | template <typename T> | ||
25 | typename boost::hash_detail::ulong_numbers<T>::type hash_value(T); | ||
26 | + template <typename T> | ||
27 | + typename boost::enable_if<boost::is_enum<T>, std::size_t>::type | ||
28 | + hash_value(T); | ||
29 | |||
30 | #if !BOOST_WORKAROUND(__DMC__, <= 0x848) | ||
31 | template <class T> std::size_t hash_value(T* const&); | ||
32 | @@ -178,7 +183,12 @@ | ||
33 | { | ||
34 | return hash_detail::hash_value_unsigned(v); | ||
35 | } | ||
36 | - | ||
37 | + template <typename T> | ||
38 | + typename boost::enable_if<boost::is_enum<T>, std::size_t>::type | ||
39 | + hash_value(T v) | ||
40 | + { | ||
41 | + return static_cast<std::size_t>(v); | ||
42 | + } | ||
43 | // Implementation by Alberto Barbati and Dave Harris. | ||
44 | #if !BOOST_WORKAROUND(__DMC__, <= 0x848) | ||
45 | template <class T> std::size_t hash_value(T* const& v) | ||