blob: 1067052692dd7d2cef7bd42df7cf6b90b36f4ae3 [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// iterator begin();
13// const_iterator begin() 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::iterator b = s.begin();
24 typename S::const_iterator cb = cs.begin();
25 if (!s.empty())
26 {
27 assert(*b == s[0]);
28 }
29 assert(b == cb);
30}
31
32int main()
33{
34 typedef std::string S;
35 test(S());
36 test(S("123"));
37}