Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:32

0001 //-----------------------------------------------------------------------------
0002 // boost variant/detail/hash_variant.hpp header file
0003 // See http://www.boost.org for updates, documentation, and revision history.
0004 //-----------------------------------------------------------------------------
0005 //
0006 // Copyright (c) 2011-2023 Antony Polukhin
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. (See
0009 // accompanying file LICENSE_1_0.txt or copy at
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 
0012 
0013 #ifndef BOOST_HASH_VARIANT_FUNCTION_HPP
0014 #define BOOST_HASH_VARIANT_FUNCTION_HPP
0015 
0016 #if defined(_MSC_VER)
0017 # pragma once
0018 #endif
0019 
0020 #include <boost/variant/variant_fwd.hpp>
0021 #include <boost/variant/static_visitor.hpp>
0022 #include <boost/variant/apply_visitor.hpp>
0023 #include <boost/functional/hash_fwd.hpp>
0024 
0025 namespace boost {
0026 
0027     namespace detail { namespace variant {
0028         struct variant_hasher: public boost::static_visitor<std::size_t> {
0029             template <class T>
0030             std::size_t operator()(T const& val) const {
0031                 boost::hash<T> hasher;
0032                 return hasher(val);
0033             }
0034         };
0035     }}
0036 
0037     template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
0038     std::size_t hash_value(variant< BOOST_VARIANT_ENUM_PARAMS(T) > const& val) {
0039         std::size_t seed = boost::apply_visitor(detail::variant::variant_hasher(), val);
0040         hash_combine(seed, val.which());
0041         return seed;
0042     }
0043 }
0044 
0045 #endif
0046