Commit 223aae6b authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Add std::string_view specialization in F14Table.h (#1031)

Summary:
- `F14Table.h`'s fallback when SIMD isn't used has template specializations
  to track which `std::hash` implementations are considered worth caching by
  `std::unordered_map`. This included `std::string` but was missing
  support for `std::string_view`. This commit adds support for marking
 `std::string_view` as not fast.
Pull Request resolved: https://github.com/facebook/folly/pull/1031

Reviewed By: nbronson

Differential Revision: D14197661

Pulled By: yfeldblum

fbshipit-source-id: bd634b5755e2794891200c7f71e9d6874a60cc38
parent cd3b981a
......@@ -29,6 +29,10 @@
#include <utility>
#include <vector>
#if FOLLY_HAS_STRING_VIEW
#include <string_view> // @manual
#endif
#include <folly/Bits.h>
#include <folly/ConstexprMath.h>
#include <folly/Likely.h>
......@@ -157,8 +161,11 @@ struct StdIsFastHash<std::hash<long double>> : std::false_type {};
template <typename... Args>
struct StdIsFastHash<std::hash<std::basic_string<Args...>>> : std::false_type {
};
// TODO: add specialization for std::basic_string_view
#if FOLLY_HAS_STRING_VIEW
template <typename... Args>
struct StdIsFastHash<std::hash<std::basic_string_view<Args...>>>
: std::false_type {};
#endif
// mimic internal node of unordered containers in STL to estimate the size
template <typename K, typename V, typename H, typename Enable = void>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment