Skip to content

Commit e4d0f0f

Browse files
committed
Added hash value for boost::basic_string_view for older version of boost.
1 parent 13d5192 commit e4d0f0f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/mqtt/string_view.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ using string_view = boost::string_view;
4040
template<class CharT, class Traits = std::char_traits<CharT> >
4141
using basic_string_view = boost::basic_string_view<CharT, Traits>;
4242

43+
#if BOOST_VERSION < 106900
44+
45+
#include <boost/container_hash/hash_fwd.hpp>
46+
47+
template <class charT, class traits>
48+
std::size_t hash_value(basic_string_view<charT, traits> s) {
49+
return boost::hash_range(s.begin(), s.end());
50+
}
51+
#endif // BOOST_VERSION < 106900
52+
4353
} // namespace MQTT_NS
4454

4555
#else // BOOST_VERSION >= 106100

0 commit comments

Comments
 (0)