| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 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 |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03 |
| 10 | |
| 11 | // <list> |
| 12 | |
| 13 | // list(initializer_list<value_type> il, const Allocator& a = allocator_type()); |
| 14 | |
| 15 | #include <list> |
| 16 | #include <cassert> |
| 17 | |
| 18 | #include "test_macros.h" |
| 19 | #include "test_allocator.h" |
| 20 | #include "min_allocator.h" |
| 21 | |
| 22 | int main(int, char**) { |
| 23 | { |
| 24 | std::list<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3)); |
| 25 | assert(d.get_allocator() == test_allocator<int>(3)); |
| 26 | assert(d.size() == 4); |
| 27 | std::list<int, test_allocator<int>>::iterator i = d.begin(); |
| 28 | assert(*i++ == 3); |
| 29 | assert(*i++ == 4); |
| 30 | assert(*i++ == 5); |
| 31 | assert(*i++ == 6); |
| 32 | } |
| 33 | { |
| 34 | std::list<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>()); |
| 35 | assert(d.get_allocator() == min_allocator<int>()); |
| 36 | assert(d.size() == 4); |
| 37 | std::list<int, min_allocator<int>>::iterator i = d.begin(); |
| 38 | assert(*i++ == 3); |
| 39 | assert(*i++ == 4); |
| 40 | assert(*i++ == 5); |
| 41 | assert(*i++ == 6); |
| 42 | } |
| 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |