diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-12-07 16:19:43 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-12-07 16:19:43 +0000 |
commit | 467b6fed9bbb7034f81b3b4ecbc3417911afdc18 (patch) | |
tree | 66ee4393d84dba09fc78cfa488b7a103b0d14eb4 /vespalib | |
parent | 2c56085ba10570d063571d5aa4a68ee538e89612 (diff) |
Use Select1st
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/stllike/hashtable_test.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/vespalib/src/tests/stllike/hashtable_test.cpp b/vespalib/src/tests/stllike/hashtable_test.cpp index 6a2fda8d30f..cbd8b28d9a8 100644 --- a/vespalib/src/tests/stllike/hashtable_test.cpp +++ b/vespalib/src/tests/stllike/hashtable_test.cpp @@ -7,6 +7,7 @@ #include <vespa/vespalib/testkit/testapp.h> #include <memory> #include <vector> +#include <vespa/vespalib/stllike/hash_map.h> using vespalib::hashtable; using std::vector; @@ -38,17 +39,12 @@ TEST("require that hashtable can store unique_ptrs") { // it = table.find(42); // This will crash, since the key is removed. } -template<typename To, typename Entry> -struct First : std::unary_function<To, Entry> { - To &operator()(Entry& p) const { return p.first; } - const To& operator()(const Entry& p) const { return p.first; } -}; template <typename K, typename V> using Entry = std::pair<K, std::unique_ptr<V>>; typedef hashtable<int, Entry<int, int>, vespalib::hash<int>, std::equal_to<int>, - First<int, Entry<int, int>>> PairHashtable; + Select1st<Entry<int, int>>> PairHashtable; TEST("require that hashtable can store pairs of <key, unique_ptr to value>") { PairHashtable table(100); @@ -75,7 +71,7 @@ TEST("require that hashtable<int> can be copied") { TEST("require that you can insert duplicates") { using Pair = std::pair<int, vespalib::string>; - using Map = hashtable<int, Pair, vespalib::hash<int>, std::equal_to<int>, First<int, Pair>>; + using Map = hashtable<int, Pair, vespalib::hash<int>, std::equal_to<int>, Select1st<Pair>>; Map m(1); EXPECT_EQUAL(0u, m.size()); |