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 | // <deque> |
10 | |
11 | // Test nested types and default template args: |
12 | |
13 | // template <class T, class Allocator = allocator<T> > |
14 | // class deque; |
15 | |
16 | // iterator, const_iterator |
17 | |
18 | #include <deque> |
19 | #include <iterator> |
20 | #include <cassert> |
21 | |
22 | #include "test_macros.h" |
23 | #include "min_allocator.h" |
24 | |
25 | int main(int, char**) |
26 | { |
27 | { |
28 | typedef std::deque<int> C; |
29 | C c; |
30 | C::iterator i; |
31 | i = c.begin(); |
32 | C::const_iterator j; |
33 | j = c.cbegin(); |
34 | assert(i == j); |
35 | } |
36 | #if TEST_STD_VER >= 11 |
37 | { |
38 | typedef std::deque<int, min_allocator<int>> C; |
39 | C c; |
40 | C::iterator i; |
41 | i = c.begin(); |
42 | C::const_iterator j; |
43 | j = c.cbegin(); |
44 | assert(i == j); |
45 | } |
46 | #endif |
47 | #if TEST_STD_VER > 11 |
48 | { // N3644 testing |
49 | std::deque<int>::iterator ii1{}, ii2{}; |
50 | std::deque<int>::iterator ii4 = ii1; |
51 | std::deque<int>::const_iterator cii{}; |
52 | assert ( ii1 == ii2 ); |
53 | assert ( ii1 == ii4 ); |
54 | |
55 | assert (!(ii1 != ii2 )); |
56 | |
57 | assert ( (ii1 == cii )); |
58 | assert ( (cii == ii1 )); |
59 | assert (!(ii1 != cii )); |
60 | assert (!(cii != ii1 )); |
61 | assert (!(ii1 < cii )); |
62 | assert (!(cii < ii1 )); |
63 | assert ( (ii1 <= cii )); |
64 | assert ( (cii <= ii1 )); |
65 | assert (!(ii1 > cii )); |
66 | assert (!(cii > ii1 )); |
67 | assert ( (ii1 >= cii )); |
68 | assert ( (cii >= ii1 )); |
69 | assert (cii - ii1 == 0); |
70 | assert (ii1 - cii == 0); |
71 | |
72 | // std::deque<int> c; |
73 | // assert ( ii1 != c.cbegin()); |
74 | // assert ( cii != c.begin()); |
75 | // assert ( cii != c.cend()); |
76 | // assert ( ii1 != c.end()); |
77 | } |
78 | #endif |
79 | |
80 | return 0; |
81 | } |
82 | |