1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // void splice_after(const_iterator p, forward_list&& x);
14 #include <forward_list>
19 #include "min_allocator.h"
22 const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
23 const T t2[] = {10, 11, 12, 13, 14, 15};
24 const std::ptrdiff_t size_t1 = std::end(t1) - std::begin(t1);
25 const std::ptrdiff_t size_t2 = std::end(t2) - std::begin(t2);
29 testd(const C& c, int p, int l)
31 typename C::const_iterator i = c.begin();
33 for (; n1 < p; ++n1, ++i)
35 for (int n2 = 0; n2 < l; ++n2, ++i)
37 for (; n1 < size_t1; ++n1, ++i)
39 assert(distance(c.begin(), c.end()) == size_t1 + l);
45 // splicing different containers
46 typedef std::forward_list<T> C;
47 for (int l = 0; l <= size_t2; ++l)
49 for (int p = 0; p <= size_t1; ++p)
51 C c1(std::begin(t1), std::end(t1));
54 c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2));
59 #if TEST_STD_VER >= 11
61 // splicing different containers
62 typedef std::forward_list<T, min_allocator<T>> C;
63 for (int l = 0; l <= size_t2; ++l)
65 for (int p = 0; p <= size_t1; ++p)
67 C c1(std::begin(t1), std::end(t1));
70 c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2));