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 // <forward_list>
11 
12 // void merge(forward_list&& x);
13 
14 #include <forward_list>
15 #include <iterator>
16 #include <cassert>
17 
18 #include "../../../min_allocator.h"
19 
20 int main()
21 {
22     {
23         typedef int T;
24         typedef std::forward_list<T> C;
25         const T t1[] = {3, 5, 6, 7, 12, 13};
26         const T t2[] = {0, 1, 2, 4, 8, 9, 10, 11, 14, 15};
27         const T t3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
28         C c1(std::begin(t1), std::end(t1));
29         C c2(std::begin(t2), std::end(t2));
30         c1.merge(c2);
31         C c3(std::begin(t3), std::end(t3));
32         assert(c1 == c3);
33     }
34 #if __cplusplus >= 201103L
35     {
36         typedef int T;
37         typedef std::forward_list<T, min_allocator<T>> C;
38         const T t1[] = {3, 5, 6, 7, 12, 13};
39         const T t2[] = {0, 1, 2, 4, 8, 9, 10, 11, 14, 15};
40         const T t3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
41         C c1(std::begin(t1), std::end(t1));
42         C c2(std::begin(t2), std::end(t2));
43         c1.merge(c2);
44         C c3(std::begin(t3), std::end(t3));
45         assert(c1 == c3);
46     }
47 #endif
48 }
49