Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:43

0001 /*=============================================================================
0002     Copyright (c) 2014 Christoph Weiss
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(FUSION_HASH_23072014_1017)
0008 #define FUSION_HASH_23072014_1017
0009 
0010 #include <boost/functional/hash.hpp>
0011 #include <boost/fusion/algorithm/iteration/fold.hpp>
0012 #include <boost/fusion/support/is_sequence.hpp>
0013 #include <boost/utility/enable_if.hpp>
0014 
0015 namespace boost { namespace fusion
0016 {
0017     namespace hashing
0018     {
0019         struct hash_combine_fold
0020         {
0021             typedef std::size_t result_type;
0022             template<typename T>
0023             inline std::size_t operator()(std::size_t seed, T const& v)
0024             {
0025                 boost::hash_combine(seed, v);
0026                 return seed;
0027             }
0028         };
0029 
0030         template <typename Seq>
0031         inline typename
0032         boost::enable_if<traits::is_sequence<Seq>, std::size_t>::type
0033         hash_value(Seq const& seq)
0034         {
0035             return fold(seq, 0, hash_combine_fold());
0036         }
0037     }
0038 
0039     using hashing::hash_value;
0040 }}
0041 
0042 #endif