Commit c7188236 authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook Github Bot

remove explicit transparent hasher from F14 usages with std::string key

Summary:
F14 tables with a std::string key now support heterogeneous
lookup by default (lookup and insert of StringPiece, std::string_view,
...).  This diff removes the explicit transparent hasher and equality
that used to be needed to get this behavior.

folly/experimental/StringKeyedUnorderedSet and Map will be removed later,
as they are unnecessary.

Reviewed By: ot, luciang

Differential Revision: D12905270

fbshipit-source-id: ecb990bb330866c089ba156f8be0a5b235c5574d
parent 9f56897b
......@@ -23,21 +23,15 @@ namespace folly {
template <
class Mapped,
class Hash = hasher<StringPiece>,
class Eq = std::equal_to<StringPiece>,
class Hash = f14::DefaultHasher<std::string>,
class Eq = f14::DefaultKeyEqual<std::string>,
class Alloc = f14::DefaultAlloc<std::pair<std::string const, Mapped>>>
struct StringKeyedUnorderedMap : public F14NodeMap<
std::string,
Mapped,
transparent<Hash>,
transparent<Eq>,
Alloc> {
using Super = F14NodeMap<
std::string,
Mapped,
transparent<Hash>,
transparent<Eq>,
Alloc>;
struct StringKeyedUnorderedMap
: public F14NodeMap<std::string, Mapped, Hash, Eq, Alloc> {
using Super = F14NodeMap<std::string, Mapped, Hash, Eq, Alloc>;
using require_transparent_hash = typename Hash::is_transparent;
using require_transparent_eq = typename Eq::is_transparent;
public:
using Super::Super;
......
......@@ -16,17 +16,15 @@
#pragma once
#include <folly/Range.h>
#include <folly/container/F14Set.h>
namespace folly {
template <
class Hash = hasher<StringPiece>,
class Eq = std::equal_to<StringPiece>,
class Hash = f14::DefaultHasher<std::string>,
class Eq = f14::DefaultKeyEqual<std::string>,
class Alloc = f14::DefaultAlloc<std::string>>
using BasicStringKeyedUnorderedSet =
F14NodeSet<std::string, transparent<Hash>, transparent<Eq>, Alloc>;
using BasicStringKeyedUnorderedSet = F14NodeSet<std::string, Hash, Eq, Alloc>;
using StringKeyedUnorderedSet = BasicStringKeyedUnorderedSet<>;
......
......@@ -113,8 +113,8 @@ using ValueLeakChecker =
using LeakCheckedUnorderedMap = StringKeyedUnorderedMap<
int,
folly::hasher<StringPiece>,
std::equal_to<StringPiece>,
folly::transparent<folly::hasher<StringPiece>>,
folly::transparent<std::equal_to<StringPiece>>,
MemoryLeakCheckerAllocator<
std::allocator<std::pair<const std::string, int>>>>;
......@@ -125,8 +125,8 @@ typedef StringKeyedMap<int, std::less<StringPiece>, KeyValuePairLeakChecker>
LeakCheckedMap;
using LeakCheckedUnorderedSet = BasicStringKeyedUnorderedSet<
folly::hasher<StringPiece>,
std::equal_to<folly::StringPiece>,
folly::transparent<folly::hasher<StringPiece>>,
folly::transparent<std::equal_to<folly::StringPiece>>,
MemoryLeakCheckerAllocator<std::allocator<std::string>>>;
TEST(StringKeyedUnorderedMapTest, sanity) {
......
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