1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
12 // vector(const vector& v);
17 #include "test_macros.h"
18 #include "test_allocator.h"
19 #include "min_allocator.h"
25 typename
C::size_type s
= x
.size();
27 LIBCPP_ASSERT(c
.__invariants());
28 assert(c
.size() == s
);
35 bool a
[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
36 bool* an
= a
+ sizeof(a
)/sizeof(a
[0]);
37 test(std::vector
<bool>(a
, an
));
40 std::vector
<bool, test_allocator
<bool> > v(3, true, test_allocator
<bool>(5));
41 std::vector
<bool, test_allocator
<bool> > v2
= v
;
43 assert(v2
.get_allocator() == v
.get_allocator());
45 #if TEST_STD_VER >= 11
47 std::vector
<bool, other_allocator
<bool> > v(3, true, other_allocator
<bool>(5));
48 std::vector
<bool, other_allocator
<bool> > v2
= v
;
50 assert(v2
.get_allocator() == other_allocator
<bool>(-2));
53 bool a
[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
54 bool* an
= a
+ sizeof(a
)/sizeof(a
[0]);
55 test(std::vector
<bool, min_allocator
<bool>>(a
, an
));
58 std::vector
<bool, min_allocator
<bool> > v(3, true, min_allocator
<bool>());
59 std::vector
<bool, min_allocator
<bool> > v2
= v
;
61 assert(v2
.get_allocator() == v
.get_allocator());