xref: /llvm-project/libcxx/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp (revision 7fc6a55688c816f5fc1a5481ae7af25be7500356)
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 // <list>
10 
11 // explicit list(const Alloc& = Alloc());
12 
13 #include <list>
14 #include <cassert>
15 #include "test_macros.h"
16 #include "test_allocator.h"
17 #include "min_allocator.h"
18 
main(int,char **)19 int main(int, char**)
20 {
21     {
22         std::list<int> l;
23         assert(l.size() == 0);
24         assert(std::distance(l.begin(), l.end()) == 0);
25     }
26     {
27         std::list<int> l((std::allocator<int>()));
28         assert(l.size() == 0);
29         assert(std::distance(l.begin(), l.end()) == 0);
30     }
31     {
32         std::list<int, limited_allocator<int, 4> > l;
33         assert(l.size() == 0);
34         assert(std::distance(l.begin(), l.end()) == 0);
35     }
36 #if TEST_STD_VER >= 11
37     {
38         std::list<int, min_allocator<int>> l;
39         assert(l.size() == 0);
40         assert(std::distance(l.begin(), l.end()) == 0);
41     }
42     {
43         std::list<int, min_allocator<int>> l((min_allocator<int>()));
44         assert(l.size() == 0);
45         assert(std::distance(l.begin(), l.end()) == 0);
46     }
47 #endif
48 
49   return 0;
50 }
51