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// <vector>
12
13// vector(initializer_list<value_type> il);
14
15#include <vector>
16#include <cassert>
17
18#include "test_macros.h"
19#include "min_allocator.h"
20
21TEST_CONSTEXPR_CXX20 bool tests() {
22 {
23 std::vector<bool> d = {true, false, false, true};
24 assert(d.size() == 4);
25 assert(d[0] == true);
26 assert(d[1] == false);
27 assert(d[2] == false);
28 assert(d[3] == true);
29 }
30 {
31 std::vector<bool, min_allocator<bool>> d = {true, false, false, true};
32 assert(d.size() == 4);
33 assert(d[0] == true);
34 assert(d[1] == false);
35 assert(d[2] == false);
36 assert(d[3] == true);
37 }
38
39 return true;
40}
41
42int main(int, char**) {
43 tests();
44#if TEST_STD_VER > 17
45 static_assert(tests());
46#endif
47 return 0;
48}
49

source code of libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp