blob: 603c1dd351a055c75d3f280c93427118c8634249 [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//
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// const charT& front() const;
13// charT& front();
14
15#include <string>
16#include <cassert>
17
18template <class S>
19void
20test(S s)
21{
22 const S& cs = s;
23 assert(&cs.front() == &cs[0]);
24 assert(&s.front() == &s[0]);
25 s.front() = typename S::value_type('z');
26 assert(s.front() == typename S::value_type('z'));
27}
28
29int main()
30{
31 typedef std::string S;
32 test(S("1"));
33 test(S("1234567890123456789012345678901234567890"));
34}