Home | History | Annotate | Download | only in deque
      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 "min_allocator.h"
     24 
     25 int main()
     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 __cplusplus >= 201103L
     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 _LIBCPP_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