Home | History | Annotate | Download | only in move.iter.op.incr
      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 // <iterator>
     11 
     12 // move_iterator
     13 
     14 // move_iterator operator++(int);
     15 
     16 #include <iterator>
     17 #include <cassert>
     18 
     19 #include "test_iterators.h"
     20 
     21 template <class It>
     22 void
     23 test(It i, It x)
     24 {
     25     std::move_iterator<It> r(i);
     26     std::move_iterator<It> rr = r++;
     27     assert(r.base() == x);
     28     assert(rr.base() == i);
     29 }
     30 
     31 int main()
     32 {
     33     char s[] = "123";
     34     test(input_iterator<char*>(s), input_iterator<char*>(s+1));
     35     test(forward_iterator<char*>(s), forward_iterator<char*>(s+1));
     36     test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1));
     37     test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1));
     38     test(s, s+1);
     39 }
     40