blob: 7f8c3423ca138c3d1aaa02a00bcfa9a8dac95c43 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <string>
11
12// reverse_iterator rbegin();
13// const_reverse_iterator rbegin() const;
14
15#include <string>
16#include <cassert>
17
18template <class S>
19void
20test(S s)
21{
22 const S& cs = s;
23 typename S::reverse_iterator b = s.rbegin();
24 typename S::const_reverse_iterator cb = cs.rbegin();
25 if (!s.empty())
26 {
27 assert(*b == s.back());
28 }
29 assert(b == cb);
30}
31
32int main()
33{
34 typedef std::string S;
35 test(S());
36 test(S("123"));
37}