1*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
2*0a6a1f1dSLionel Sambuc //
3*0a6a1f1dSLionel Sambuc //                     The LLVM Compiler Infrastructure
4*0a6a1f1dSLionel Sambuc //
5*0a6a1f1dSLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6*0a6a1f1dSLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7*0a6a1f1dSLionel Sambuc //
8*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
9*0a6a1f1dSLionel Sambuc 
10*0a6a1f1dSLionel Sambuc // <algorithm>
11*0a6a1f1dSLionel Sambuc 
12*0a6a1f1dSLionel Sambuc // template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
13*0a6a1f1dSLionel Sambuc //   bool
14*0a6a1f1dSLionel Sambuc //   is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
15*0a6a1f1dSLionel Sambuc //                  ForwardIterator2 first2, BinaryPredicate pred);
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc #include <algorithm>
18*0a6a1f1dSLionel Sambuc #include <functional>
19*0a6a1f1dSLionel Sambuc #include <cassert>
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc #include "test_iterators.h"
22*0a6a1f1dSLionel Sambuc 
23*0a6a1f1dSLionel Sambuc #if _LIBCPP_STD_VER > 11
24*0a6a1f1dSLionel Sambuc #define HAS_FOUR_ITERATOR_VERSION
25*0a6a1f1dSLionel Sambuc #endif
26*0a6a1f1dSLionel Sambuc 
27*0a6a1f1dSLionel Sambuc int comparison_count = 0;
28*0a6a1f1dSLionel Sambuc template <typename T>
counting_equals(const T & a,const T & b)29*0a6a1f1dSLionel Sambuc bool counting_equals ( const T &a, const T &b ) {
30*0a6a1f1dSLionel Sambuc     ++comparison_count;
31*0a6a1f1dSLionel Sambuc     return a == b;
32*0a6a1f1dSLionel Sambuc     }
33*0a6a1f1dSLionel Sambuc 
34*0a6a1f1dSLionel Sambuc 
main()35*0a6a1f1dSLionel Sambuc int main()
36*0a6a1f1dSLionel Sambuc {
37*0a6a1f1dSLionel Sambuc     {
38*0a6a1f1dSLionel Sambuc         const int ia[] = {0};
39*0a6a1f1dSLionel Sambuc         const int ib[] = {0};
40*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
41*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
42*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + 0),
43*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
44*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
45*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
46*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
47*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
48*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
49*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
50*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
51*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
52*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
53*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
54*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
55*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
56*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
57*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
58*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
59*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
60*0a6a1f1dSLionel Sambuc #endif
61*0a6a1f1dSLionel Sambuc     }
62*0a6a1f1dSLionel Sambuc     {
63*0a6a1f1dSLionel Sambuc         const int ia[] = {0};
64*0a6a1f1dSLionel Sambuc         const int ib[] = {1};
65*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
66*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
67*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
68*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
69*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
70*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
71*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
72*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
73*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
74*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
75*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
76*0a6a1f1dSLionel Sambuc #endif
77*0a6a1f1dSLionel Sambuc     }
78*0a6a1f1dSLionel Sambuc 
79*0a6a1f1dSLionel Sambuc     {
80*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0};
81*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 0};
82*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
83*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
84*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
85*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
86*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
87*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
88*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
89*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
90*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
91*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
92*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
93*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
94*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
95*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
96*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
97*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
98*0a6a1f1dSLionel Sambuc #endif
99*0a6a1f1dSLionel Sambuc     }
100*0a6a1f1dSLionel Sambuc     {
101*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0};
102*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 1};
103*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
104*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
105*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
106*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
107*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
108*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
109*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
110*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
111*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
112*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
113*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
114*0a6a1f1dSLionel Sambuc #endif
115*0a6a1f1dSLionel Sambuc     }
116*0a6a1f1dSLionel Sambuc     {
117*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0};
118*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0};
119*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
120*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
121*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
122*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
123*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
124*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
125*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
126*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
127*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
128*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
129*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
130*0a6a1f1dSLionel Sambuc #endif
131*0a6a1f1dSLionel Sambuc     }
132*0a6a1f1dSLionel Sambuc     {
133*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0};
134*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 1};
135*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
136*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
137*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
138*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
139*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
140*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
141*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
142*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
143*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
144*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
145*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
146*0a6a1f1dSLionel Sambuc #endif
147*0a6a1f1dSLionel Sambuc     }
148*0a6a1f1dSLionel Sambuc     {
149*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1};
150*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 0};
151*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
152*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
153*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
154*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
155*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
156*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
157*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
158*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
159*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
160*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
161*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
162*0a6a1f1dSLionel Sambuc #endif
163*0a6a1f1dSLionel Sambuc     }
164*0a6a1f1dSLionel Sambuc     {
165*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1};
166*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 1};
167*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
168*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
169*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
170*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
171*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
172*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
173*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
174*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
175*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
176*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
177*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
178*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
179*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
180*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
181*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
182*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
183*0a6a1f1dSLionel Sambuc #endif
184*0a6a1f1dSLionel Sambuc     }
185*0a6a1f1dSLionel Sambuc     {
186*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1};
187*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0};
188*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
189*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
190*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
191*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
192*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
193*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
194*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
195*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
196*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
197*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
198*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
199*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
200*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
201*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
202*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
203*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
204*0a6a1f1dSLionel Sambuc #endif
205*0a6a1f1dSLionel Sambuc     }
206*0a6a1f1dSLionel Sambuc     {
207*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1};
208*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 1};
209*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
210*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
211*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
212*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
213*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
214*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
215*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
216*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
217*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
218*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
219*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
220*0a6a1f1dSLionel Sambuc #endif
221*0a6a1f1dSLionel Sambuc     }
222*0a6a1f1dSLionel Sambuc     {
223*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 0};
224*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 0};
225*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
226*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
227*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
228*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
229*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
230*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
231*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
232*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
233*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
234*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
235*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
236*0a6a1f1dSLionel Sambuc #endif
237*0a6a1f1dSLionel Sambuc     }
238*0a6a1f1dSLionel Sambuc     {
239*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 0};
240*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 1};
241*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
242*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
243*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
244*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
245*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
246*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
247*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
248*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
249*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
250*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
251*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
252*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
253*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
254*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
255*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
256*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
257*0a6a1f1dSLionel Sambuc #endif
258*0a6a1f1dSLionel Sambuc     }
259*0a6a1f1dSLionel Sambuc     {
260*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 0};
261*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0};
262*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
263*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
264*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
265*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
266*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
267*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
268*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
269*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
270*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
271*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
272*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
273*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
274*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
275*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
276*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
277*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
278*0a6a1f1dSLionel Sambuc #endif
279*0a6a1f1dSLionel Sambuc     }
280*0a6a1f1dSLionel Sambuc     {
281*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 0};
282*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 1};
283*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
284*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
285*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
286*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
287*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
288*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
289*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
290*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
291*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
292*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
293*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
294*0a6a1f1dSLionel Sambuc #endif
295*0a6a1f1dSLionel Sambuc     }
296*0a6a1f1dSLionel Sambuc     {
297*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 1};
298*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 0};
299*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
300*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
301*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
302*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
303*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
304*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
305*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
306*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
307*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
308*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
309*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
310*0a6a1f1dSLionel Sambuc #endif
311*0a6a1f1dSLionel Sambuc     }
312*0a6a1f1dSLionel Sambuc     {
313*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 1};
314*0a6a1f1dSLionel Sambuc         const int ib[] = {0, 1};
315*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
316*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
317*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
318*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
319*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
320*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
321*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
322*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
323*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
324*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
325*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
326*0a6a1f1dSLionel Sambuc #endif
327*0a6a1f1dSLionel Sambuc     }
328*0a6a1f1dSLionel Sambuc     {
329*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 1};
330*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0};
331*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
332*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
333*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
334*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
335*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
336*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
337*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
338*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
339*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
340*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
341*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
342*0a6a1f1dSLionel Sambuc #endif
343*0a6a1f1dSLionel Sambuc     }
344*0a6a1f1dSLionel Sambuc     {
345*0a6a1f1dSLionel Sambuc         const int ia[] = {1, 1};
346*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 1};
347*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
348*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
349*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
350*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
351*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
352*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
353*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
354*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
355*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
356*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
357*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
358*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
359*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
360*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
361*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
362*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
363*0a6a1f1dSLionel Sambuc #endif
364*0a6a1f1dSLionel Sambuc     }
365*0a6a1f1dSLionel Sambuc 
366*0a6a1f1dSLionel Sambuc     {
367*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
368*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 0};
369*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
370*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
371*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
372*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
373*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
374*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
375*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
376*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
377*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
378*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
379*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
380*0a6a1f1dSLionel Sambuc #endif
381*0a6a1f1dSLionel Sambuc     }
382*0a6a1f1dSLionel Sambuc     {
383*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
384*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 1};
385*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
386*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
387*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
388*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
389*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
390*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
391*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
392*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
393*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
394*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
395*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
396*0a6a1f1dSLionel Sambuc #endif
397*0a6a1f1dSLionel Sambuc     }
398*0a6a1f1dSLionel Sambuc     {
399*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
400*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 2};
401*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
402*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
403*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
404*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
405*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
406*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
407*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
408*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
409*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
410*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
411*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
412*0a6a1f1dSLionel Sambuc #endif
413*0a6a1f1dSLionel Sambuc     }
414*0a6a1f1dSLionel Sambuc     {
415*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
416*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 1, 0};
417*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
418*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
419*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
420*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
421*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
422*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
423*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
424*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
425*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
426*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
427*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
428*0a6a1f1dSLionel Sambuc #endif
429*0a6a1f1dSLionel Sambuc     }
430*0a6a1f1dSLionel Sambuc     {
431*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
432*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 1, 1};
433*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
434*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
435*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
436*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
437*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
438*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
439*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
440*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
441*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
442*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
443*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
444*0a6a1f1dSLionel Sambuc #endif
445*0a6a1f1dSLionel Sambuc     }
446*0a6a1f1dSLionel Sambuc     {
447*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
448*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 1, 2};
449*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
450*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
451*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
452*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
453*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
454*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
455*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
456*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
457*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
458*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
459*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
460*0a6a1f1dSLionel Sambuc #endif
461*0a6a1f1dSLionel Sambuc     }
462*0a6a1f1dSLionel Sambuc     {
463*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
464*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 2, 0};
465*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
466*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
467*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
468*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
469*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
470*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
471*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
472*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
473*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
474*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
475*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
476*0a6a1f1dSLionel Sambuc #endif
477*0a6a1f1dSLionel Sambuc     }
478*0a6a1f1dSLionel Sambuc     {
479*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
480*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 2, 1};
481*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
482*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
483*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
484*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
485*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
486*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
487*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
488*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
489*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
490*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
491*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
492*0a6a1f1dSLionel Sambuc #endif
493*0a6a1f1dSLionel Sambuc     }
494*0a6a1f1dSLionel Sambuc     {
495*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 0};
496*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 2, 2};
497*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
498*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
499*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
500*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
501*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
502*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
503*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
504*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
505*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
506*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
507*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
508*0a6a1f1dSLionel Sambuc #endif
509*0a6a1f1dSLionel Sambuc     }
510*0a6a1f1dSLionel Sambuc     {
511*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 1};
512*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 0};
513*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
514*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
515*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
516*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
517*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
518*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
519*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
520*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
521*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
522*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
523*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
524*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
525*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
526*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
527*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
528*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
529*0a6a1f1dSLionel Sambuc #endif
530*0a6a1f1dSLionel Sambuc     }
531*0a6a1f1dSLionel Sambuc     {
532*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 1};
533*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 1};
534*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
535*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
536*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
537*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
538*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
539*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
540*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
541*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
542*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
543*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
544*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
545*0a6a1f1dSLionel Sambuc #endif
546*0a6a1f1dSLionel Sambuc     }
547*0a6a1f1dSLionel Sambuc     {
548*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1, 2};
549*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 2};
550*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
551*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
552*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
553*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
554*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
555*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
556*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
557*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
558*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
559*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
560*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
561*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
562*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
563*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
564*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
565*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
566*0a6a1f1dSLionel Sambuc #endif
567*0a6a1f1dSLionel Sambuc     }
568*0a6a1f1dSLionel Sambuc     {
569*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1, 2};
570*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 2, 0};
571*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
572*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
573*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
574*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
575*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
576*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
577*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
578*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
579*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
580*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
581*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
582*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
583*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
584*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
585*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
586*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
587*0a6a1f1dSLionel Sambuc #endif
588*0a6a1f1dSLionel Sambuc     }
589*0a6a1f1dSLionel Sambuc     {
590*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1, 2};
591*0a6a1f1dSLionel Sambuc         const int ib[] = {2, 1, 0};
592*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
593*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
594*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
595*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
596*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
597*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
598*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
599*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
600*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
601*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
602*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
603*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
604*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
605*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
606*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
607*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
608*0a6a1f1dSLionel Sambuc #endif
609*0a6a1f1dSLionel Sambuc     }
610*0a6a1f1dSLionel Sambuc     {
611*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1, 2};
612*0a6a1f1dSLionel Sambuc         const int ib[] = {2, 0, 1};
613*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
614*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
615*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
616*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
617*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
618*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
619*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
620*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
621*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
622*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
623*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
624*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
625*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
626*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
627*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
628*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
629*0a6a1f1dSLionel Sambuc #endif
630*0a6a1f1dSLionel Sambuc     }
631*0a6a1f1dSLionel Sambuc     {
632*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 1};
633*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 1};
634*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
635*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
636*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
637*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
638*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
639*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
640*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
641*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
642*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
643*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
644*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
645*0a6a1f1dSLionel Sambuc #endif
646*0a6a1f1dSLionel Sambuc     }
647*0a6a1f1dSLionel Sambuc     {
648*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 0, 1};
649*0a6a1f1dSLionel Sambuc         const int ib[] = {1, 0, 0};
650*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
651*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
652*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
653*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
654*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
655*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
656*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
657*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
658*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
659*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
660*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
661*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
662*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
663*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + 1),
664*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
665*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
666*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
667*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
668*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
669*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
670*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
671*0a6a1f1dSLionel Sambuc #endif
672*0a6a1f1dSLionel Sambuc     }
673*0a6a1f1dSLionel Sambuc     {
674*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1, 2, 3, 0, 5, 6, 2, 4, 4};
675*0a6a1f1dSLionel Sambuc         const int ib[] = {4, 2, 3, 0, 1, 4, 0, 5, 6, 2};
676*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
677*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
678*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
679*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
680*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
681*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
682*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
683*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
684*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
685*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
686*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == true);
687*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
688*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
689*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + 1),
690*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
691*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
692*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
693*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
694*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
695*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
696*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
697*0a6a1f1dSLionel Sambuc         comparison_count = 0;
698*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
699*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
700*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
701*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa - 1),
702*0a6a1f1dSLionel Sambuc                                    counting_equals<const int>) == false);
703*0a6a1f1dSLionel Sambuc         assert ( comparison_count > 0 );
704*0a6a1f1dSLionel Sambuc         comparison_count = 0;
705*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(random_access_iterator<const int*>(ia),
706*0a6a1f1dSLionel Sambuc                                    random_access_iterator<const int*>(ia + sa),
707*0a6a1f1dSLionel Sambuc                                    random_access_iterator<const int*>(ib),
708*0a6a1f1dSLionel Sambuc                                    random_access_iterator<const int*>(ib + sa - 1),
709*0a6a1f1dSLionel Sambuc                                    counting_equals<const int>) == false);
710*0a6a1f1dSLionel Sambuc         assert ( comparison_count == 0 );
711*0a6a1f1dSLionel Sambuc #endif
712*0a6a1f1dSLionel Sambuc     }
713*0a6a1f1dSLionel Sambuc     {
714*0a6a1f1dSLionel Sambuc         const int ia[] = {0, 1, 2, 3, 0, 5, 6, 2, 4, 4};
715*0a6a1f1dSLionel Sambuc         const int ib[] = {4, 2, 3, 0, 1, 4, 0, 5, 6, 0};
716*0a6a1f1dSLionel Sambuc         const unsigned sa = sizeof(ia)/sizeof(ia[0]);
717*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
718*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
719*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
720*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
721*0a6a1f1dSLionel Sambuc #ifdef HAS_FOUR_ITERATOR_VERSION
722*0a6a1f1dSLionel Sambuc         assert(std::is_permutation(forward_iterator<const int*>(ia),
723*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ia + sa),
724*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib),
725*0a6a1f1dSLionel Sambuc                                    forward_iterator<const int*>(ib + sa),
726*0a6a1f1dSLionel Sambuc                                    std::equal_to<const int>()) == false);
727*0a6a1f1dSLionel Sambuc #endif
728*0a6a1f1dSLionel Sambuc     }
729*0a6a1f1dSLionel Sambuc }
730