From 001169749289209823c5f567afed1f7e8f5c1ef0 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 28 Apr 2022 20:42:48 +0300 Subject: [PATCH] Add hash_value (refs #110) --- include/boost/core/detail/string_view.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/boost/core/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index c742198..14c7edc 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -38,8 +38,12 @@ namespace boost { +// forward declaration of boost::basic_string_view from Utility template class basic_string_view; +// forward declaration of boost::hash_range from ContainerHash +template std::size_t hash_range( It, It ); + namespace core { namespace detail @@ -1161,6 +1165,11 @@ public: } #endif + + inline friend std::size_t hash_value( basic_string_view const& sv ) + { + return boost::hash_range( sv.begin(), sv.end() ); + } }; // stream inserter