Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame^] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. 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 | template <class S> |
| 19 | void |
| 20 | test(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 | |
| 32 | int main() |
| 33 | { |
| 34 | typedef std::string S; |
| 35 | test(S()); |
| 36 | test(S("123")); |
| 37 | } |