Home | History | Annotate | Download | only in string.accessors
      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 // allocator_type get_allocator() const;
     13 
     14 #include <string>
     15 #include <cassert>
     16 
     17 #include "../../test_allocator.h"
     18 
     19 template <class S>
     20 void
     21 test(const S& s, const typename S::allocator_type& a)
     22 {
     23     assert(s.get_allocator() == a);
     24 }
     25 
     26 int main()
     27 {
     28     typedef test_allocator<char> A;
     29     typedef std::basic_string<char, std::char_traits<char>, A> S;
     30     test(S(""), A());
     31     test(S("abcde", A(1)), A(1));
     32     test(S("abcdefghij", A(2)), A(2));
     33     test(S("abcdefghijklmnopqrst", A(3)), A(3));
     34 }
     35