1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12 // constexpr bool // constexpr after C++17
13 // is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
14 // ForwardIterator2 first2, BinaryPredicate pred);
20 #include "test_macros.h"
21 #include "test_iterators.h"
23 int comparison_count
= 0;
25 bool counting_equals ( const T
&a
, const T
&b
) {
31 constexpr bool test_constexpr() {
36 std::equal_to
<int> c
{};
37 return !std::is_permutation(std::begin(ia
), std::end(ia
), std::begin(ib
) , c
)
38 && !std::is_permutation(std::begin(ia
), std::end(ia
), std::begin(ib
), std::end(ib
), c
)
39 && std::is_permutation(std::begin(ib
), std::end(ib
), std::begin(ic
) , c
)
40 && std::is_permutation(std::begin(ib
), std::end(ib
), std::begin(ic
), std::end(ic
), c
)
41 && !std::is_permutation(std::begin(ic
), std::end(ic
), std::begin(id
), std::end(id
), c
)
49 bool operator==(const S
& other
) = delete;
54 bool operator()(const S
& a
, const S
& b
) const { return a
.i_
== b
.i_
; }
63 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
64 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
65 forward_iterator
<const int*>(ia
+ 0),
66 forward_iterator
<const int*>(ib
),
67 std::equal_to
<const int>()) == true);
68 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
69 forward_iterator
<const int*>(ia
+ sa
),
70 forward_iterator
<const int*>(ib
),
71 std::equal_to
<const int>()) == true);
72 #if TEST_STD_VER >= 14
73 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
74 forward_iterator
<const int*>(ia
+ sa
),
75 forward_iterator
<const int*>(ib
),
76 forward_iterator
<const int*>(ib
+ sa
),
77 std::equal_to
<const int>()) == true);
78 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
79 forward_iterator
<const int*>(ia
+ sa
),
80 forward_iterator
<const int*>(ib
),
81 forward_iterator
<const int*>(ib
+ sa
- 1),
82 std::equal_to
<const int>()) == false);
88 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
89 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
90 forward_iterator
<const int*>(ia
+ sa
),
91 forward_iterator
<const int*>(ib
),
92 std::equal_to
<const int>()) == false);
93 #if TEST_STD_VER >= 14
94 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
95 forward_iterator
<const int*>(ia
+ sa
),
96 forward_iterator
<const int*>(ib
),
97 forward_iterator
<const int*>(ib
+ sa
),
98 std::equal_to
<const int>()) == false);
103 const int ia
[] = {0, 0};
104 const int ib
[] = {0, 0};
105 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
106 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
107 forward_iterator
<const int*>(ia
+ sa
),
108 forward_iterator
<const int*>(ib
),
109 std::equal_to
<const int>()) == true);
110 #if TEST_STD_VER >= 14
111 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
112 forward_iterator
<const int*>(ia
+ sa
),
113 forward_iterator
<const int*>(ib
),
114 forward_iterator
<const int*>(ib
+ sa
),
115 std::equal_to
<const int>()) == true);
116 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
117 forward_iterator
<const int*>(ia
+ sa
),
118 forward_iterator
<const int*>(ib
),
119 forward_iterator
<const int*>(ib
+ sa
- 1),
120 std::equal_to
<const int>()) == false);
124 const int ia
[] = {0, 0};
125 const int ib
[] = {0, 1};
126 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
127 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
128 forward_iterator
<const int*>(ia
+ sa
),
129 forward_iterator
<const int*>(ib
),
130 std::equal_to
<const int>()) == false);
131 #if TEST_STD_VER >= 14
132 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
133 forward_iterator
<const int*>(ia
+ sa
),
134 forward_iterator
<const int*>(ib
),
135 forward_iterator
<const int*>(ib
+ sa
),
136 std::equal_to
<const int>()) == false);
140 const int ia
[] = {0, 0};
141 const int ib
[] = {1, 0};
142 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
143 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
144 forward_iterator
<const int*>(ia
+ sa
),
145 forward_iterator
<const int*>(ib
),
146 std::equal_to
<const int>()) == false);
147 #if TEST_STD_VER >= 14
148 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
149 forward_iterator
<const int*>(ia
+ sa
),
150 forward_iterator
<const int*>(ib
),
151 forward_iterator
<const int*>(ib
+ sa
),
152 std::equal_to
<const int>()) == false);
156 const int ia
[] = {0, 0};
157 const int ib
[] = {1, 1};
158 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
159 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
160 forward_iterator
<const int*>(ia
+ sa
),
161 forward_iterator
<const int*>(ib
),
162 std::equal_to
<const int>()) == false);
163 #if TEST_STD_VER >= 14
164 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
165 forward_iterator
<const int*>(ia
+ sa
),
166 forward_iterator
<const int*>(ib
),
167 forward_iterator
<const int*>(ib
+ sa
),
168 std::equal_to
<const int>()) == false);
172 const int ia
[] = {0, 1};
173 const int ib
[] = {0, 0};
174 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
175 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
176 forward_iterator
<const int*>(ia
+ sa
),
177 forward_iterator
<const int*>(ib
),
178 std::equal_to
<const int>()) == false);
179 #if TEST_STD_VER >= 14
180 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
181 forward_iterator
<const int*>(ia
+ sa
),
182 forward_iterator
<const int*>(ib
),
183 forward_iterator
<const int*>(ib
+ sa
),
184 std::equal_to
<const int>()) == false);
188 const int ia
[] = {0, 1};
189 const int ib
[] = {0, 1};
190 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
191 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
192 forward_iterator
<const int*>(ia
+ sa
),
193 forward_iterator
<const int*>(ib
),
194 std::equal_to
<const int>()) == true);
195 #if TEST_STD_VER >= 14
196 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
197 forward_iterator
<const int*>(ia
+ sa
),
198 forward_iterator
<const int*>(ib
),
199 forward_iterator
<const int*>(ib
+ sa
),
200 std::equal_to
<const int>()) == true);
201 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
202 forward_iterator
<const int*>(ia
+ sa
),
203 forward_iterator
<const int*>(ib
),
204 forward_iterator
<const int*>(ib
+ sa
- 1),
205 std::equal_to
<const int>()) == false);
209 const int ia
[] = {0, 1};
210 const int ib
[] = {1, 0};
211 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
212 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
213 forward_iterator
<const int*>(ia
+ sa
),
214 forward_iterator
<const int*>(ib
),
215 std::equal_to
<const int>()) == true);
216 #if TEST_STD_VER >= 14
217 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
218 forward_iterator
<const int*>(ia
+ sa
),
219 forward_iterator
<const int*>(ib
),
220 forward_iterator
<const int*>(ib
+ sa
),
221 std::equal_to
<const int>()) == true);
222 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
223 forward_iterator
<const int*>(ia
+ sa
),
224 forward_iterator
<const int*>(ib
),
225 forward_iterator
<const int*>(ib
+ sa
- 1),
226 std::equal_to
<const int>()) == false);
230 const int ia
[] = {0, 1};
231 const int ib
[] = {1, 1};
232 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
233 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
234 forward_iterator
<const int*>(ia
+ sa
),
235 forward_iterator
<const int*>(ib
),
236 std::equal_to
<const int>()) == false);
237 #if TEST_STD_VER >= 14
238 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
239 forward_iterator
<const int*>(ia
+ sa
),
240 forward_iterator
<const int*>(ib
),
241 forward_iterator
<const int*>(ib
+ sa
),
242 std::equal_to
<const int>()) == false);
246 const int ia
[] = {1, 0};
247 const int ib
[] = {0, 0};
248 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
249 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
250 forward_iterator
<const int*>(ia
+ sa
),
251 forward_iterator
<const int*>(ib
),
252 std::equal_to
<const int>()) == false);
253 #if TEST_STD_VER >= 14
254 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
255 forward_iterator
<const int*>(ia
+ sa
),
256 forward_iterator
<const int*>(ib
),
257 forward_iterator
<const int*>(ib
+ sa
),
258 std::equal_to
<const int>()) == false);
262 const int ia
[] = {1, 0};
263 const int ib
[] = {0, 1};
264 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
265 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
266 forward_iterator
<const int*>(ia
+ sa
),
267 forward_iterator
<const int*>(ib
),
268 std::equal_to
<const int>()) == true);
269 #if TEST_STD_VER >= 14
270 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
271 forward_iterator
<const int*>(ia
+ sa
),
272 forward_iterator
<const int*>(ib
),
273 forward_iterator
<const int*>(ib
+ sa
),
274 std::equal_to
<const int>()) == true);
275 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
276 forward_iterator
<const int*>(ia
+ sa
),
277 forward_iterator
<const int*>(ib
),
278 forward_iterator
<const int*>(ib
+ sa
- 1),
279 std::equal_to
<const int>()) == false);
283 const int ia
[] = {1, 0};
284 const int ib
[] = {1, 0};
285 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
286 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
287 forward_iterator
<const int*>(ia
+ sa
),
288 forward_iterator
<const int*>(ib
),
289 std::equal_to
<const int>()) == true);
290 #if TEST_STD_VER >= 14
291 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
292 forward_iterator
<const int*>(ia
+ sa
),
293 forward_iterator
<const int*>(ib
),
294 forward_iterator
<const int*>(ib
+ sa
),
295 std::equal_to
<const int>()) == true);
296 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
297 forward_iterator
<const int*>(ia
+ sa
),
298 forward_iterator
<const int*>(ib
),
299 forward_iterator
<const int*>(ib
+ sa
- 1),
300 std::equal_to
<const int>()) == false);
304 const int ia
[] = {1, 0};
305 const int ib
[] = {1, 1};
306 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
307 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
308 forward_iterator
<const int*>(ia
+ sa
),
309 forward_iterator
<const int*>(ib
),
310 std::equal_to
<const int>()) == false);
311 #if TEST_STD_VER >= 14
312 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
313 forward_iterator
<const int*>(ia
+ sa
),
314 forward_iterator
<const int*>(ib
),
315 forward_iterator
<const int*>(ib
+ sa
),
316 std::equal_to
<const int>()) == false);
320 const int ia
[] = {1, 1};
321 const int ib
[] = {0, 0};
322 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
323 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
324 forward_iterator
<const int*>(ia
+ sa
),
325 forward_iterator
<const int*>(ib
),
326 std::equal_to
<const int>()) == false);
327 #if TEST_STD_VER >= 14
328 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
329 forward_iterator
<const int*>(ia
+ sa
),
330 forward_iterator
<const int*>(ib
),
331 forward_iterator
<const int*>(ib
+ sa
),
332 std::equal_to
<const int>()) == false);
336 const int ia
[] = {1, 1};
337 const int ib
[] = {0, 1};
338 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
339 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
340 forward_iterator
<const int*>(ia
+ sa
),
341 forward_iterator
<const int*>(ib
),
342 std::equal_to
<const int>()) == false);
343 #if TEST_STD_VER >= 14
344 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
345 forward_iterator
<const int*>(ia
+ sa
),
346 forward_iterator
<const int*>(ib
),
347 forward_iterator
<const int*>(ib
+ sa
),
348 std::equal_to
<const int>()) == false);
352 const int ia
[] = {1, 1};
353 const int ib
[] = {1, 0};
354 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
355 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
356 forward_iterator
<const int*>(ia
+ sa
),
357 forward_iterator
<const int*>(ib
),
358 std::equal_to
<const int>()) == false);
359 #if TEST_STD_VER >= 14
360 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
361 forward_iterator
<const int*>(ia
+ sa
),
362 forward_iterator
<const int*>(ib
),
363 forward_iterator
<const int*>(ib
+ sa
),
364 std::equal_to
<const int>()) == false);
368 const int ia
[] = {1, 1};
369 const int ib
[] = {1, 1};
370 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
371 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
372 forward_iterator
<const int*>(ia
+ sa
),
373 forward_iterator
<const int*>(ib
),
374 std::equal_to
<const int>()) == true);
375 #if TEST_STD_VER >= 14
376 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
377 forward_iterator
<const int*>(ia
+ sa
),
378 forward_iterator
<const int*>(ib
),
379 forward_iterator
<const int*>(ib
+ sa
),
380 std::equal_to
<const int>()) == true);
381 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
382 forward_iterator
<const int*>(ia
+ sa
),
383 forward_iterator
<const int*>(ib
),
384 forward_iterator
<const int*>(ib
+ sa
- 1),
385 std::equal_to
<const int>()) == false);
390 const int ia
[] = {0, 0, 0};
391 const int ib
[] = {1, 0, 0};
392 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
393 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
394 forward_iterator
<const int*>(ia
+ sa
),
395 forward_iterator
<const int*>(ib
),
396 std::equal_to
<const int>()) == false);
397 #if TEST_STD_VER >= 14
398 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
399 forward_iterator
<const int*>(ia
+ sa
),
400 forward_iterator
<const int*>(ib
),
401 forward_iterator
<const int*>(ib
+ sa
),
402 std::equal_to
<const int>()) == false);
406 const int ia
[] = {0, 0, 0};
407 const int ib
[] = {1, 0, 1};
408 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
409 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
410 forward_iterator
<const int*>(ia
+ sa
),
411 forward_iterator
<const int*>(ib
),
412 std::equal_to
<const int>()) == false);
413 #if TEST_STD_VER >= 14
414 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
415 forward_iterator
<const int*>(ia
+ sa
),
416 forward_iterator
<const int*>(ib
),
417 forward_iterator
<const int*>(ib
+ sa
),
418 std::equal_to
<const int>()) == false);
422 const int ia
[] = {0, 0, 0};
423 const int ib
[] = {1, 0, 2};
424 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
425 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
426 forward_iterator
<const int*>(ia
+ sa
),
427 forward_iterator
<const int*>(ib
),
428 std::equal_to
<const int>()) == false);
429 #if TEST_STD_VER >= 14
430 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
431 forward_iterator
<const int*>(ia
+ sa
),
432 forward_iterator
<const int*>(ib
),
433 forward_iterator
<const int*>(ib
+ sa
),
434 std::equal_to
<const int>()) == false);
438 const int ia
[] = {0, 0, 0};
439 const int ib
[] = {1, 1, 0};
440 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
441 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
442 forward_iterator
<const int*>(ia
+ sa
),
443 forward_iterator
<const int*>(ib
),
444 std::equal_to
<const int>()) == false);
445 #if TEST_STD_VER >= 14
446 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
447 forward_iterator
<const int*>(ia
+ sa
),
448 forward_iterator
<const int*>(ib
),
449 forward_iterator
<const int*>(ib
+ sa
),
450 std::equal_to
<const int>()) == false);
454 const int ia
[] = {0, 0, 0};
455 const int ib
[] = {1, 1, 1};
456 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
457 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
458 forward_iterator
<const int*>(ia
+ sa
),
459 forward_iterator
<const int*>(ib
),
460 std::equal_to
<const int>()) == false);
461 #if TEST_STD_VER >= 14
462 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
463 forward_iterator
<const int*>(ia
+ sa
),
464 forward_iterator
<const int*>(ib
),
465 forward_iterator
<const int*>(ib
+ sa
),
466 std::equal_to
<const int>()) == false);
470 const int ia
[] = {0, 0, 0};
471 const int ib
[] = {1, 1, 2};
472 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
473 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
474 forward_iterator
<const int*>(ia
+ sa
),
475 forward_iterator
<const int*>(ib
),
476 std::equal_to
<const int>()) == false);
477 #if TEST_STD_VER >= 14
478 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
479 forward_iterator
<const int*>(ia
+ sa
),
480 forward_iterator
<const int*>(ib
),
481 forward_iterator
<const int*>(ib
+ sa
),
482 std::equal_to
<const int>()) == false);
486 const int ia
[] = {0, 0, 0};
487 const int ib
[] = {1, 2, 0};
488 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
489 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
490 forward_iterator
<const int*>(ia
+ sa
),
491 forward_iterator
<const int*>(ib
),
492 std::equal_to
<const int>()) == false);
493 #if TEST_STD_VER >= 14
494 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
495 forward_iterator
<const int*>(ia
+ sa
),
496 forward_iterator
<const int*>(ib
),
497 forward_iterator
<const int*>(ib
+ sa
),
498 std::equal_to
<const int>()) == false);
502 const int ia
[] = {0, 0, 0};
503 const int ib
[] = {1, 2, 1};
504 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
505 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
506 forward_iterator
<const int*>(ia
+ sa
),
507 forward_iterator
<const int*>(ib
),
508 std::equal_to
<const int>()) == false);
509 #if TEST_STD_VER >= 14
510 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
511 forward_iterator
<const int*>(ia
+ sa
),
512 forward_iterator
<const int*>(ib
),
513 forward_iterator
<const int*>(ib
+ sa
),
514 std::equal_to
<const int>()) == false);
518 const int ia
[] = {0, 0, 0};
519 const int ib
[] = {1, 2, 2};
520 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
521 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
522 forward_iterator
<const int*>(ia
+ sa
),
523 forward_iterator
<const int*>(ib
),
524 std::equal_to
<const int>()) == false);
525 #if TEST_STD_VER >= 14
526 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
527 forward_iterator
<const int*>(ia
+ sa
),
528 forward_iterator
<const int*>(ib
),
529 forward_iterator
<const int*>(ib
+ sa
),
530 std::equal_to
<const int>()) == false);
534 const int ia
[] = {0, 0, 1};
535 const int ib
[] = {1, 0, 0};
536 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
537 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
538 forward_iterator
<const int*>(ia
+ sa
),
539 forward_iterator
<const int*>(ib
),
540 std::equal_to
<const int>()) == true);
541 #if TEST_STD_VER >= 14
542 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
543 forward_iterator
<const int*>(ia
+ sa
),
544 forward_iterator
<const int*>(ib
),
545 forward_iterator
<const int*>(ib
+ sa
),
546 std::equal_to
<const int>()) == true);
547 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
548 forward_iterator
<const int*>(ia
+ sa
),
549 forward_iterator
<const int*>(ib
),
550 forward_iterator
<const int*>(ib
+ sa
- 1),
551 std::equal_to
<const int>()) == false);
555 const int ia
[] = {0, 0, 1};
556 const int ib
[] = {1, 0, 1};
557 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
558 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
559 forward_iterator
<const int*>(ia
+ sa
),
560 forward_iterator
<const int*>(ib
),
561 std::equal_to
<const int>()) == false);
562 #if TEST_STD_VER >= 14
563 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
564 forward_iterator
<const int*>(ia
+ sa
),
565 forward_iterator
<const int*>(ib
),
566 forward_iterator
<const int*>(ib
+ sa
),
567 std::equal_to
<const int>()) == false);
571 const int ia
[] = {0, 1, 2};
572 const int ib
[] = {1, 0, 2};
573 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
574 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
575 forward_iterator
<const int*>(ia
+ sa
),
576 forward_iterator
<const int*>(ib
),
577 std::equal_to
<const int>()) == true);
578 #if TEST_STD_VER >= 14
579 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
580 forward_iterator
<const int*>(ia
+ sa
),
581 forward_iterator
<const int*>(ib
),
582 forward_iterator
<const int*>(ib
+ sa
),
583 std::equal_to
<const int>()) == true);
584 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
585 forward_iterator
<const int*>(ia
+ sa
),
586 forward_iterator
<const int*>(ib
),
587 forward_iterator
<const int*>(ib
+ sa
- 1),
588 std::equal_to
<const int>()) == false);
592 const int ia
[] = {0, 1, 2};
593 const int ib
[] = {1, 2, 0};
594 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
595 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
596 forward_iterator
<const int*>(ia
+ sa
),
597 forward_iterator
<const int*>(ib
),
598 std::equal_to
<const int>()) == true);
599 #if TEST_STD_VER >= 14
600 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
601 forward_iterator
<const int*>(ia
+ sa
),
602 forward_iterator
<const int*>(ib
),
603 forward_iterator
<const int*>(ib
+ sa
),
604 std::equal_to
<const int>()) == true);
605 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
606 forward_iterator
<const int*>(ia
+ sa
),
607 forward_iterator
<const int*>(ib
),
608 forward_iterator
<const int*>(ib
+ sa
- 1),
609 std::equal_to
<const int>()) == false);
613 const int ia
[] = {0, 1, 2};
614 const int ib
[] = {2, 1, 0};
615 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
616 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
617 forward_iterator
<const int*>(ia
+ sa
),
618 forward_iterator
<const int*>(ib
),
619 std::equal_to
<const int>()) == true);
620 #if TEST_STD_VER >= 14
621 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
622 forward_iterator
<const int*>(ia
+ sa
),
623 forward_iterator
<const int*>(ib
),
624 forward_iterator
<const int*>(ib
+ sa
),
625 std::equal_to
<const int>()) == true);
626 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
627 forward_iterator
<const int*>(ia
+ sa
),
628 forward_iterator
<const int*>(ib
),
629 forward_iterator
<const int*>(ib
+ sa
- 1),
630 std::equal_to
<const int>()) == false);
634 const int ia
[] = {0, 1, 2};
635 const int ib
[] = {2, 0, 1};
636 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
637 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
638 forward_iterator
<const int*>(ia
+ sa
),
639 forward_iterator
<const int*>(ib
),
640 std::equal_to
<const int>()) == true);
641 #if TEST_STD_VER >= 14
642 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
643 forward_iterator
<const int*>(ia
+ sa
),
644 forward_iterator
<const int*>(ib
),
645 forward_iterator
<const int*>(ib
+ sa
),
646 std::equal_to
<const int>()) == true);
647 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
648 forward_iterator
<const int*>(ia
+ sa
),
649 forward_iterator
<const int*>(ib
),
650 forward_iterator
<const int*>(ib
+ sa
- 1),
651 std::equal_to
<const int>()) == false);
655 const int ia
[] = {0, 0, 1};
656 const int ib
[] = {1, 0, 1};
657 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
658 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
659 forward_iterator
<const int*>(ia
+ sa
),
660 forward_iterator
<const int*>(ib
),
661 std::equal_to
<const int>()) == false);
662 #if TEST_STD_VER >= 14
663 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
664 forward_iterator
<const int*>(ia
+ sa
),
665 forward_iterator
<const int*>(ib
),
666 forward_iterator
<const int*>(ib
+ sa
),
667 std::equal_to
<const int>()) == false);
671 const int ia
[] = {0, 0, 1};
672 const int ib
[] = {1, 0, 0};
673 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
674 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
675 forward_iterator
<const int*>(ia
+ sa
),
676 forward_iterator
<const int*>(ib
),
677 std::equal_to
<const int>()) == true);
678 #if TEST_STD_VER >= 14
679 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
680 forward_iterator
<const int*>(ia
+ sa
),
681 forward_iterator
<const int*>(ib
),
682 forward_iterator
<const int*>(ib
+ sa
),
683 std::equal_to
<const int>()) == true);
684 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
685 forward_iterator
<const int*>(ia
+ sa
),
686 forward_iterator
<const int*>(ib
+ 1),
687 forward_iterator
<const int*>(ib
+ sa
),
688 std::equal_to
<const int>()) == false);
689 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
690 forward_iterator
<const int*>(ia
+ sa
),
691 forward_iterator
<const int*>(ib
),
692 forward_iterator
<const int*>(ib
+ sa
- 1),
693 std::equal_to
<const int>()) == false);
697 const int ia
[] = {0, 1, 2, 3, 0, 5, 6, 2, 4, 4};
698 const int ib
[] = {4, 2, 3, 0, 1, 4, 0, 5, 6, 2};
699 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
700 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
701 forward_iterator
<const int*>(ia
+ sa
),
702 forward_iterator
<const int*>(ib
),
703 std::equal_to
<const int>()) == true);
704 #if TEST_STD_VER >= 14
705 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
706 forward_iterator
<const int*>(ia
+ sa
),
707 forward_iterator
<const int*>(ib
),
708 forward_iterator
<const int*>(ib
+ sa
),
709 std::equal_to
<const int>()) == true);
710 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
711 forward_iterator
<const int*>(ia
+ sa
),
712 forward_iterator
<const int*>(ib
+ 1),
713 forward_iterator
<const int*>(ib
+ sa
),
714 std::equal_to
<const int>()) == false);
715 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
716 forward_iterator
<const int*>(ia
+ sa
),
717 forward_iterator
<const int*>(ib
),
718 forward_iterator
<const int*>(ib
+ sa
- 1),
719 std::equal_to
<const int>()) == false);
720 comparison_count
= 0;
721 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
722 forward_iterator
<const int*>(ia
+ sa
),
723 forward_iterator
<const int*>(ib
),
724 forward_iterator
<const int*>(ib
+ sa
- 1),
725 counting_equals
<const int>) == false);
726 assert ( comparison_count
> 0 );
727 comparison_count
= 0;
728 assert(std::is_permutation(random_access_iterator
<const int*>(ia
),
729 random_access_iterator
<const int*>(ia
+ sa
),
730 random_access_iterator
<const int*>(ib
),
731 random_access_iterator
<const int*>(ib
+ sa
- 1),
732 counting_equals
<const int>) == false);
733 assert ( comparison_count
== 0 );
737 const int ia
[] = {0, 1, 2, 3, 0, 5, 6, 2, 4, 4};
738 const int ib
[] = {4, 2, 3, 0, 1, 4, 0, 5, 6, 0};
739 const unsigned sa
= sizeof(ia
)/sizeof(ia
[0]);
740 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
741 forward_iterator
<const int*>(ia
+ sa
),
742 forward_iterator
<const int*>(ib
),
743 std::equal_to
<const int>()) == false);
744 #if TEST_STD_VER >= 14
745 assert(std::is_permutation(forward_iterator
<const int*>(ia
),
746 forward_iterator
<const int*>(ia
+ sa
),
747 forward_iterator
<const int*>(ib
),
748 forward_iterator
<const int*>(ib
+ sa
),
749 std::equal_to
<const int>()) == false);
753 const S a
[] = {S(0), S(1)};
754 const S b
[] = {S(1), S(0)};
755 const unsigned sa
= sizeof(a
)/sizeof(a
[0]);
756 assert(std::is_permutation(forward_iterator
<const S
*>(a
),
757 forward_iterator
<const S
*>(a
+ sa
),
758 forward_iterator
<const S
*>(b
),
760 #if TEST_STD_VER >= 14
761 assert(std::is_permutation(forward_iterator
<const S
*>(a
),
762 forward_iterator
<const S
*>(a
+ sa
),
763 forward_iterator
<const S
*>(b
),
764 forward_iterator
<const S
*>(b
+ sa
),
769 #if TEST_STD_VER > 17
770 static_assert(test_constexpr());