1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
15 // node_type extract(const_iterator);
18 #include "test_macros.h"
19 #include "min_allocator.h"
22 template <class Container
>
23 void test(Container
& c
)
25 std::size_t sz
= c
.size();
27 auto some_key
= c
.cbegin()->first
;
29 for (auto first
= c
.cbegin(); first
!= c
.cend();)
31 auto key_value
= first
->first
;
32 typename
Container::node_type t
= c
.extract(first
++);
34 assert(t
.key() == key_value
);
36 assert(t
.key() == some_key
);
37 assert(t
.get_allocator() == c
.get_allocator());
38 assert(sz
== c
.size());
41 assert(c
.size() == 0);
47 using map_type
= std::multimap
<int, int>;
48 map_type m
= {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
53 std::multimap
<Counter
<int>, Counter
<int>> m
=
54 {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
55 assert(Counter_base::gConstructed
== 12);
57 assert(Counter_base::gConstructed
== 0);
62 std::multimap
<int, int, std::less
<int>,
63 min_allocator
<std::pair
<const int, int>>>;
64 min_alloc_map m
= {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};