Home | History | Annotate | Download | only in string.capacity
      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 length() 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)
     22 {
     23     assert(s.length() == s.size());
     24 }
     25 
     26 int main()
     27 {
     28     {
     29     typedef std::string S;
     30     test(S());
     31     test(S("123"));
     32     test(S("12345678901234567890123456789012345678901234567890"));
     33     }
     34 #if __cplusplus >= 201103L
     35     {
     36     typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
     37     test(S());
     38     test(S("123"));
     39     test(S("12345678901234567890123456789012345678901234567890"));
     40     }
     41 #endif
     42 }
     43