Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/fusion/sequence/hash.hpp @ 125:34e428693f5d vext
Vext -> Repoint
author | Chris Cannam |
---|---|
date | Thu, 14 Jun 2018 11:15:39 +0100 |
parents | f46d142149f5 |
children |
rev | line source |
---|---|
Chris@102 | 1 /*============================================================================= |
Chris@102 | 2 Copyright (c) 2014 Christoph Weiss |
Chris@102 | 3 |
Chris@102 | 4 Distributed under the Boost Software License, Version 1.0. (See accompanying |
Chris@102 | 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Chris@102 | 6 ==============================================================================*/ |
Chris@102 | 7 #if !defined(FUSION_HASH_23072014_1017) |
Chris@102 | 8 #define FUSION_HASH_23072014_1017 |
Chris@102 | 9 |
Chris@102 | 10 #include <boost/functional/hash.hpp> |
Chris@102 | 11 #include <boost/fusion/algorithm/iteration/fold.hpp> |
Chris@102 | 12 #include <boost/fusion/support/is_sequence.hpp> |
Chris@102 | 13 #include <boost/utility/enable_if.hpp> |
Chris@102 | 14 |
Chris@102 | 15 namespace boost { namespace fusion |
Chris@102 | 16 { |
Chris@102 | 17 namespace hashing |
Chris@102 | 18 { |
Chris@102 | 19 struct hash_combine_fold |
Chris@102 | 20 { |
Chris@102 | 21 typedef std::size_t result_type; |
Chris@102 | 22 template<typename T> |
Chris@102 | 23 inline std::size_t operator()(std::size_t seed, T const& v) |
Chris@102 | 24 { |
Chris@102 | 25 boost::hash_combine(seed, v); |
Chris@102 | 26 return seed; |
Chris@102 | 27 } |
Chris@102 | 28 }; |
Chris@102 | 29 |
Chris@102 | 30 template <typename Seq> |
Chris@102 | 31 inline typename |
Chris@102 | 32 boost::enable_if<traits::is_sequence<Seq>, std::size_t>::type |
Chris@102 | 33 hash_value(Seq const& seq) |
Chris@102 | 34 { |
Chris@102 | 35 return fold(seq, 0, hash_combine_fold()); |
Chris@102 | 36 } |
Chris@102 | 37 } |
Chris@102 | 38 |
Chris@102 | 39 using hashing::hash_value; |
Chris@102 | 40 }} |
Chris@102 | 41 |
Chris@102 | 42 #endif |