diff options
Diffstat (limited to 'vespalib/src/tests/stllike/hashtable_test.cpp')
-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()); |