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