diff --git a/parallel_hashmap/phmap.h b/parallel_hashmap/phmap.h index 07a0db9..3034340 100644 --- a/parallel_hashmap/phmap.h +++ b/parallel_hashmap/phmap.h @@ -2360,6 +2360,7 @@ public: using EmbeddedSet = RefSet; using EmbeddedIterator= typename EmbeddedSet::iterator; using EmbeddedConstIterator= typename EmbeddedSet::const_iterator; + using constructor = typename EmbeddedSet::constructor; using init_type = typename PolicyTraits::init_type; using key_type = typename PolicyTraits::key_type; using slot_type = typename PolicyTraits::slot_type; diff --git a/tests/parallel_hash_map_test.cc b/tests/parallel_hash_map_test.cc index 535163a..3b49246 100644 --- a/tests/parallel_hash_map_test.cc +++ b/tests/parallel_hash_map_test.cc @@ -12,8 +12,10 @@ namespace { TEST(THIS_TEST_NAME, ThreadSafeContains) { // We can't test mutable keys, or non-copyable keys with ThisMap. // Test that the nodes have the proper API. - ThisMap m = { {1, 7}, {2, 9} }; - const ThisMap& const_m(m); + using Map = ThisMap; + + Map m = { {1, 7}, {2, 9} }; + const Map& const_m(m); auto val = 0; auto get_value = [&val](const int& v) { val = v; }; @@ -40,21 +42,18 @@ TEST(THIS_TEST_NAME, ThreadSafeContains) { m.try_emplace_l(4, [](int& ) { assert(0); /* should not be called when value constructed */ }, 999); EXPECT_EQ(m[4], 999); -#if PHMAP_HAVE_CC17 // generic lambda // insert a value that is not already present. m.lazy_emplace_l(5, [](int& v) { assert(0); /* should not be called when value constructed */ v = 6; }, - [](const auto& ctor) { ctor(5, 13); }); + [](const Map::constructor& ctor) { ctor(5, 13); }); EXPECT_EQ(m[5], 13); // change a value that is present m.lazy_emplace_l(5, [](int& v) { v = 6; }, - [](const auto& ctor) { assert(0); /* should not be called when value exists */ctor(5, 13); }); + [](const Map::constructor& ctor) { assert(0); /* should not be called when value exists */ctor(5, 13); }); EXPECT_EQ(m[5], 6); -#endif - } } // namespace