Skip to content

Commit 4af614d

Browse files
insert_node_type*
1 parent 731a987 commit 4af614d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type.pass.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@ TEST_CONSTEXPR_CXX26 void verify_insert_return_type(T&& t) {
4242
}
4343

4444
template <class Container>
45-
TEST_CONSTEXPR_CXX26 std::pair<Container, typename Container::node_type>
46-
node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
47-
Container c;
45+
TEST_CONSTEXPR_CXX26 typename Container::node_type
46+
node_factory(Container& c, typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
4847
auto p = c.insert({key, mapped});
4948
assert(p.second);
50-
return {c, c.extract(p.first)};
49+
return c.extract(p.first);
5150
}
5251

5352
template <class Container>
5453
TEST_CONSTEXPR_CXX26 void testContainer(Container& c) {
5554
auto* nf = &node_factory<Container>;
5655

56+
Container c2;
57+
5758
for (int i = 0; i != 10; ++i) {
58-
auto [/*Container*/ staticContainer, /*typename Container::node_type*/ node] = nf(i, i + 1);
59+
typename Container::node_type node = nf(c2, i, i + 1);
5960
assert(!node.empty());
6061
typename Container::insert_return_type irt = c.insert(std::move(node));
6162
assert(node.empty());
@@ -78,7 +79,7 @@ TEST_CONSTEXPR_CXX26 void testContainer(Container& c) {
7879
}
7980

8081
{ // Insert duplicate node.
81-
auto [/*Container*/ staticContainer, /*typename Container::node_type*/ dupl] = nf(0, 42);
82+
typename Container::node_type dupl = nf(c2, 0, 42);
8283
auto irt = c.insert(std::move(dupl));
8384
assert(dupl.empty());
8485
assert(!irt.inserted);

libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type_hint.pass.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@
1919
#include "min_allocator.h"
2020

2121
template <class Container>
22-
TEST_CONSTEXPR_CXX26 std::pair<Container, typename Container::node_type>
23-
node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
24-
Container c;
22+
TEST_CONSTEXPR_CXX26 typename Container::node_type
23+
node_factory(Container& c, typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
2524
auto p = c.insert({key, mapped});
2625
assert(p.second);
27-
return {c, c.extract(p.first)};
26+
return c.extract(p.first);
2827
}
2928

3029
template <class Container>
3130
TEST_CONSTEXPR_CXX26 void test(Container& c) {
3231
auto* nf = &node_factory<Container>;
3332

33+
Container c2;
34+
3435
for (int i = 0; i != 10; ++i) {
35-
auto [/*Container*/ staticContainer, /*typename Container::node_type*/ node] = nf(i, i + 1);
36+
typename Container::node_type node = nf(c2, i, i + 1);
3637
assert(!node.empty());
3738
std::size_t prev = c.size();
3839
auto it = c.insert(c.end(), std::move(node));

0 commit comments

Comments
 (0)