1 // { dg-options "-std=gnu++2a" }
2 // { dg-do run { target c++2a } }
4 // Copyright (C) 2018 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
21 #include <unordered_map>
22 #include <testsuite_hooks.h>
24 auto is_odd_pair
= [](const std::pair
<const int, std::string
>& p
)
26 return p
.first
% 2 != 0;
32 std::unordered_map
<int, std::string
> um
{ { 10, "A" }, { 11, "B" },
33 { 12, "C" }, { 14, "D" },
34 { 15, "E" }, { 17, "F" },
35 { 18, "G" }, { 19, "H" } };
36 std::erase_if(um
, is_odd_pair
);
37 std::unordered_map
<int, std::string
> t
{ { 10, "A" }, { 12, "C" },
38 { 14, "D" }, { 18, "G" } };
45 std::unordered_multimap
<int, std::string
> umm
{ { 20, "S" }, { 21, "T" },
46 { 22, "U" }, { 22, "V" },
47 { 23, "W" }, { 23, "X" },
48 { 24, "Y" }, { 25, "Z" } };
49 std::erase_if(umm
, is_odd_pair
);
50 std::unordered_multimap
<int, std::string
> t
{ { 20, "S" }, { 22, "U" },
51 { 22, "V" }, { 24, "Y" } };