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 // <string>
11 
12 //       reverse_iterator rbegin();
13 // const_reverse_iterator rbegin() const;
14 
15 #include <string>
16 #include <cassert>
17 
18 #include "min_allocator.h"
19 
20 template <class S>
21 void
test(S s)22 test(S s)
23 {
24     const S& cs = s;
25     typename S::reverse_iterator b = s.rbegin();
26     typename S::const_reverse_iterator cb = cs.rbegin();
27     if (!s.empty())
28     {
29         assert(*b == s.back());
30     }
31     assert(b == cb);
32 }
33 
main()34 int main()
35 {
36     {
37     typedef std::string S;
38     test(S());
39     test(S("123"));
40     }
41 #if __cplusplus >= 201103L
42     {
43     typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
44     test(S());
45     test(S("123"));
46     }
47 #endif
48 }
49