make test c++11 compatible

This commit is contained in:
greg
2020-10-18 10:53:29 -04:00
parent b1f76095bf
commit c32372b342
2 changed files with 7 additions and 7 deletions
+1
View File
@@ -2360,6 +2360,7 @@ public:
using EmbeddedSet = RefSet<Policy, Hash, Eq, Alloc>;
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;
+6 -7
View File
@@ -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<int, int> m = { {1, 7}, {2, 9} };
const ThisMap<int, int>& const_m(m);
using Map = ThisMap<int, int>;
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