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