]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/23_containers/unordered_multiset/96088.cc
aa137ec930207c610878a74d1d71c4f46eee17ac
1 // { dg-do run { target c++17 } }
2 // { dg-require-effective-target std_allocator_new }
4 // Copyright (C) 2021 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/>.
23 #include <string_view>
25 #include <unordered_set>
27 #include <testsuite_hooks.h>
28 #include <replacement_memory_operators.h>
30 static constexpr std::initializer_list
<const char*> lst
= {
31 "long_str_for_dynamic_allocating"
37 __gnu_test::counter::reset();
38 std::unordered_multiset
<std::string
,
39 std::hash
<std::string_view
>,
40 std::equal_to
<std::string_view
>> foo
;
41 foo
.insert(lst
.begin(), lst
.end());
42 VERIFY( foo
.size() == 1 );
44 VERIFY( __gnu_test::counter::count() == 3 );
45 VERIFY( __gnu_test::counter::get()._M_increments
== 3 );
51 __gnu_test::counter::reset();
52 std::unordered_multiset
<std::string
> foo
;
53 foo
.insert(lst
.begin(), lst
.end());
54 VERIFY( foo
.size() == 1 );
56 VERIFY( __gnu_test::counter::count() == 3 );
57 VERIFY( __gnu_test::counter::get()._M_increments
== 3 );