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 // iterator begin(); 13 // const_iterator begin() const; 14 15 #include <string> 16 #include <cassert> 17 18 #include "min_allocator.h" 19 20 template <class S> 21 void test(S s)22test(S s) 23 { 24 const S& cs = s; 25 typename S::iterator b = s.begin(); 26 typename S::const_iterator cb = cs.begin(); 27 if (!s.empty()) 28 { 29 assert(*b == s[0]); 30 } 31 assert(b == cb); 32 } 33 main()34int 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