1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <vector>
11 
12 // size_type capacity() const;
13 
14 #include <vector>
15 #include <cassert>
16 
17 #include "min_allocator.h"
18 #include "asan_testing.h"
19 
main()20 int main()
21 {
22     {
23         std::vector<int> v;
24         assert(v.capacity() == 0);
25         assert(is_contiguous_container_asan_correct(v));
26     }
27     {
28         std::vector<int> v(100);
29         assert(v.capacity() == 100);
30         v.push_back(0);
31         assert(v.capacity() > 101);
32         assert(is_contiguous_container_asan_correct(v));
33     }
34 #if __cplusplus >= 201103L
35     {
36         std::vector<int, min_allocator<int>> v;
37         assert(v.capacity() == 0);
38         assert(is_contiguous_container_asan_correct(v));
39     }
40     {
41         std::vector<int, min_allocator<int>> v(100);
42         assert(v.capacity() == 100);
43         v.push_back(0);
44         assert(v.capacity() > 101);
45         assert(is_contiguous_container_asan_correct(v));
46     }
47 #endif
48 }
49