12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_HASH_AJK_20MAY2022_HPP
- #define BOOST_OPTIONAL_DETAIL_OPTIONAL_HASH_AJK_20MAY2022_HPP
- #include <boost/optional/optional_fwd.hpp>
- #include <boost/config.hpp>
- #if !defined(BOOST_OPTIONAL_CONFIG_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
- #include <functional>
- namespace std
- {
- template <typename T>
- struct hash<boost::optional<T> >
- {
- typedef std::size_t result_type;
- typedef boost::optional<T> argument_type;
- BOOST_CONSTEXPR result_type operator()(const argument_type& arg) const {
- return arg ? std::hash<T>()(*arg) : result_type();
- }
- };
- template <typename T>
- struct hash<boost::optional<T&> >
- {
- typedef std::size_t result_type;
- typedef boost::optional<T&> argument_type;
- BOOST_CONSTEXPR result_type operator()(const argument_type& arg) const {
- return arg ? std::hash<T>()(*arg) : result_type();
- }
- };
- }
- #endif
- #endif
|