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 remove(const value_type& v);
13
14#include <forward_list>
15#include <iterator>
16#include <cassert>
17
18#include "min_allocator.h"
19
20int main()
21{
22    {
23        typedef int T;
24        typedef std::forward_list<T> C;
25        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
26        const T t2[] = {5, 5, 5};
27        C c1(std::begin(t1), std::end(t1));
28        C c2(std::begin(t2), std::end(t2));
29        c1.remove(0);
30        assert(c1 == c2);
31    }
32    {
33        typedef int T;
34        typedef std::forward_list<T> C;
35        const T t1[] = {0, 0, 0, 0};
36        C c1(std::begin(t1), std::end(t1));
37        C c2;
38        c1.remove(0);
39        assert(c1 == c2);
40    }
41    {
42        typedef int T;
43        typedef std::forward_list<T> C;
44        const T t1[] = {5, 5, 5};
45        const T t2[] = {5, 5, 5};
46        C c1(std::begin(t1), std::end(t1));
47        C c2(std::begin(t2), std::end(t2));
48        c1.remove(0);
49        assert(c1 == c2);
50    }
51    {
52        typedef int T;
53        typedef std::forward_list<T> C;
54        C c1;
55        C c2;
56        c1.remove(0);
57        assert(c1 == c2);
58    }
59    {
60        typedef int T;
61        typedef std::forward_list<T> C;
62        const T t1[] = {5, 5, 5, 0};
63        const T t2[] = {5, 5, 5};
64        C c1(std::begin(t1), std::end(t1));
65        C c2(std::begin(t2), std::end(t2));
66        c1.remove(0);
67        assert(c1 == c2);
68    }
69#if __cplusplus >= 201103L
70    {
71        typedef int T;
72        typedef std::forward_list<T, min_allocator<T>> C;
73        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
74        const T t2[] = {5, 5, 5};
75        C c1(std::begin(t1), std::end(t1));
76        C c2(std::begin(t2), std::end(t2));
77        c1.remove(0);
78        assert(c1 == c2);
79    }
80    {
81        typedef int T;
82        typedef std::forward_list<T, min_allocator<T>> C;
83        const T t1[] = {0, 0, 0, 0};
84        C c1(std::begin(t1), std::end(t1));
85        C c2;
86        c1.remove(0);
87        assert(c1 == c2);
88    }
89    {
90        typedef int T;
91        typedef std::forward_list<T, min_allocator<T>> C;
92        const T t1[] = {5, 5, 5};
93        const T t2[] = {5, 5, 5};
94        C c1(std::begin(t1), std::end(t1));
95        C c2(std::begin(t2), std::end(t2));
96        c1.remove(0);
97        assert(c1 == c2);
98    }
99    {
100        typedef int T;
101        typedef std::forward_list<T, min_allocator<T>> C;
102        C c1;
103        C c2;
104        c1.remove(0);
105        assert(c1 == c2);
106    }
107    {
108        typedef int T;
109        typedef std::forward_list<T, min_allocator<T>> C;
110        const T t1[] = {5, 5, 5, 0};
111        const T t2[] = {5, 5, 5};
112        C c1(std::begin(t1), std::end(t1));
113        C c2(std::begin(t2), std::end(t2));
114        c1.remove(0);
115        assert(c1 == c2);
116    }
117#endif
118}
119