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 // size_type size() const; 13 14 #include <string> 15 #include <cassert> 16 17 #include "min_allocator.h" 18 19 template <class S> 20 void 21 test(const S& s, typename S::size_type c) 22 { 23 assert(s.size() == c); 24 } 25 26 int main() 27 { 28 { 29 typedef std::string S; 30 test(S(), 0); 31 test(S("123"), 3); 32 test(S("12345678901234567890123456789012345678901234567890"), 50); 33 } 34 #if __cplusplus >= 201103L 35 { 36 typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; 37 test(S(), 0); 38 test(S("123"), 3); 39 test(S("12345678901234567890123456789012345678901234567890"), 50); 40 } 41 #endif 42 } 43