1 // Copyright (C) 2008-2025 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
19 // { dg-do run { target c++11 } }
22 #include <testsuite_allocator.h>
24 using namespace __gnu_test
;
28 typedef std::vector
<int, tracker_allocator
<int> > Container
;
29 const int arr10
[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
32 tracker_allocator_counter::reset();
34 Container
c({ 2, 4, 1 });
35 ok
= check_construct_destroy("Construct from init-list", 3, 0) && ok
;
39 ok
= check_construct_destroy("Construct from init-list", 3, 3) && ok
;
42 Container
c(arr10
, arr10
+ 10);
43 tracker_allocator_counter::reset();
44 c
.insert(c
.begin() + 7, { 234, 42, 1 });
45 ok
= check_construct_destroy("Insert init-list", 13, 10) && ok
;
48 ok
= check_construct_destroy("Insert init-list", 13, 23) && ok
;
52 tracker_allocator_counter::reset();
54 ok
= check_construct_destroy("Assign init-list", 3, 0) && ok
;
57 ok
= check_construct_destroy("Assign init-list", 3, 3) && ok
;