Home | History | Annotate | Download | only in string_assign
      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 // UNSUPPORTED: c++98, c++03
     11 
     12 // <string>
     13 
     14 // basic_string& assign(initializer_list<charT> il);
     15 
     16 #include <string>
     17 #include <cassert>
     18 
     19 #include "test_macros.h"
     20 #include "min_allocator.h"
     21 
     22 int main()
     23 {
     24     {
     25         std::string s("123");
     26         s.assign({'a', 'b', 'c'});
     27         assert(s == "abc");
     28     }
     29     {
     30         typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
     31         S s("123");
     32         s.assign({'a', 'b', 'c'});
     33         assert(s == "abc");
     34     }
     35 }
     36