// Copyright (C) 2022 Andrzej Krzemienski. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // akrzemi1@gmail.com #ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_HASH_AJK_20MAY2022_HPP #define BOOST_OPTIONAL_DETAIL_OPTIONAL_HASH_AJK_20MAY2022_HPP #include #include #if !defined(BOOST_OPTIONAL_CONFIG_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) #include namespace std { template struct hash > { typedef std::size_t result_type; typedef boost::optional argument_type; BOOST_CONSTEXPR result_type operator()(const argument_type& arg) const { return arg ? std::hash()(*arg) : result_type(); } }; template struct hash > { typedef std::size_t result_type; typedef boost::optional argument_type; BOOST_CONSTEXPR result_type operator()(const argument_type& arg) const { return arg ? std::hash()(*arg) : result_type(); } }; } #endif // !defined(BOOST_OPTIONAL_CONFIG_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) #endif // header guard