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 insert(const_iterator p, initializer_list<charT> il);
13
14 #if _LIBCPP_DEBUG >= 1
15 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
16 #endif
17
18 #include <string>
19 #include <cassert>
20
21 #include "min_allocator.h"
22
main()23 int main()
24 {
25 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
26 {
27 std::string s("123456");
28 std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
29 assert(i - s.begin() == 3);
30 assert(s == "123abc456");
31 }
32 #if __cplusplus >= 201103L
33 {
34 typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
35 S s("123456");
36 S::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
37 assert(i - s.begin() == 3);
38 assert(s == "123abc456");
39 }
40 #endif
41 #if _LIBCPP_DEBUG >= 1
42 {
43 std::string s;
44 std::string s2;
45 s.insert(s2.begin(), {'a', 'b', 'c'});
46 assert(false);
47 }
48 #endif
49 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
50 }
51