iter.pass.cpp revision 83e2c4d877fe2d7793868b1c6a5d9525a7c4d431
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// reverse_iterator
13
14// explicit reverse_iterator(Iter x);
15
16#include <iterator>
17#include <cassert>
18
19#include "test_iterators.h"
20
21template <class It>
22void
23test(It i)
24{
25    std::reverse_iterator<It> r(i);
26    assert(r.base() == i);
27}
28
29int main()
30{
31    const char s[] = "123";
32    test(bidirectional_iterator<const char*>(s));
33    test(random_access_iterator<const char*>(s));
34    test(s);
35}
36