diff options
author | Kenneth Heafield <github@kheafield.com> | 2020-02-26 02:43:53 +0300 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2020-02-26 02:43:53 +0300 |
commit | 25bb09b510085798738475fc10974a3f0c967871 (patch) | |
tree | 81e11dcce084a08c9e9d5a58172f1dd610d68773 /util | |
parent | 2fc4130cd79949df2545f3ab48798b8634a00a79 (diff) |
Fix StringPiece hash for ancient ICU
Diffstat (limited to 'util')
-rw-r--r-- | util/string_piece_hash.hh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/util/string_piece_hash.hh b/util/string_piece_hash.hh index 5c8c525..6ff6f88 100644 --- a/util/string_piece_hash.hh +++ b/util/string_piece_hash.hh @@ -1,15 +1,24 @@ #ifndef UTIL_STRING_PIECE_HASH_H #define UTIL_STRING_PIECE_HASH_H +#include "util/have.hh" #include "util/string_piece.hh" #include <boost/functional/hash.hpp> #include <boost/version.hpp> +#ifdef HAVE_ICU +U_NAMESPACE_BEGIN +#endif + inline size_t hash_value(const StringPiece &str) { return boost::hash_range(str.data(), str.data() + str.length()); } +#ifdef HAVE_ICU +U_NAMESPACE_END +#endif + /* Support for lookup of StringPiece in boost::unordered_map<std::string> */ struct StringPieceCompatibleHash : public std::unary_function<const StringPiece &, size_t> { size_t operator()(const StringPiece &str) const { |