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 // template <class InputIter> vector(InputIter first, InputIter last,
13 // const allocator_type& a);
19 #include "test_macros.h"
20 #include "test_iterators.h"
21 #include "min_allocator.h"
23 template <class C
, class Iterator
>
25 test(Iterator first
, Iterator last
, const typename
C::allocator_type
& a
)
28 LIBCPP_ASSERT(c
.__invariants());
29 assert(c
.size() == static_cast<std::size_t>(std::distance(first
, last
)));
30 for (typename
C::const_iterator i
= c
.cbegin(), e
= c
.cend(); i
!= e
; ++i
, ++first
)
36 bool a
[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
37 bool* an
= a
+ sizeof(a
)/sizeof(a
[0]);
39 std::allocator
<bool> alloc
;
40 test
<std::vector
<bool> >(input_iterator
<const bool*>(a
), input_iterator
<const bool*>(an
), alloc
);
41 test
<std::vector
<bool> >(forward_iterator
<const bool*>(a
), forward_iterator
<const bool*>(an
), alloc
);
42 test
<std::vector
<bool> >(bidirectional_iterator
<const bool*>(a
), bidirectional_iterator
<const bool*>(an
), alloc
);
43 test
<std::vector
<bool> >(random_access_iterator
<const bool*>(a
), random_access_iterator
<const bool*>(an
), alloc
);
44 test
<std::vector
<bool> >(a
, an
, alloc
);
46 #if TEST_STD_VER >= 11
48 min_allocator
<bool> alloc
;
49 test
<std::vector
<bool, min_allocator
<bool>> >(input_iterator
<const bool*>(a
), input_iterator
<const bool*>(an
), alloc
);
50 test
<std::vector
<bool, min_allocator
<bool>> >(forward_iterator
<const bool*>(a
), forward_iterator
<const bool*>(an
), alloc
);
51 test
<std::vector
<bool, min_allocator
<bool>> >(bidirectional_iterator
<const bool*>(a
), bidirectional_iterator
<const bool*>(an
), alloc
);
52 test
<std::vector
<bool, min_allocator
<bool>> >(random_access_iterator
<const bool*>(a
), random_access_iterator
<const bool*>(an
), alloc
);
53 test
<std::vector
<bool, min_allocator
<bool>> >(a
, an
, alloc
);