forked from cplusplus/fundamentals-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunc.html
508 lines (409 loc) · 26.9 KB
/
func.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
<cxx-clause id="func">
<h1>Function objects</h1>
<cxx-section id="header.functional.synop">
<h1>Header <code><experimental/functional></code> synopsis</h1>
<cxx-ednote class="para">
The following header synopsis fixes the missing <tt>noexcept</tt> specifications of the comparison functions as recently resolved by <a href="http://cplusplus.github.io/LWG/lwg-active.html#2401">LWG 2401</a>.
We consider this change <em>editorial</em> at this point because the two different declarations were already in conflict,
and this change does not have impact on the actual prototype specifications, which will have the same specifiers as in C++14.
</cxx-ednote>
<pre><code>#include <functional>
namespace std {
namespace experimental {
inline namespace fundamentals_v2 {
// See <cxx-ref in="cxx" to="bind"></cxx-ref>, Function object binders
template <class T> constexpr bool is_bind_expression_v
= is_bind_expression<T>::value;
template <class T> constexpr int is_placeholder_v
= is_placeholder<T>::value;
<cxx-ref insynopsis="" to="func.wrap.func"></cxx-ref>
template<class> class function; <i>// undefined</i>
template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
template<class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
template<class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template<class R, class... ArgTypes>
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
<cxx-ref insynopsis="" to="func.searchers"></cxx-ref>
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
class default_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher;
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
default_searcher<ForwardIterator, BinaryPredicate>
make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_searcher(
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_horspool_searcher(
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
<cxx-ref insynopsis="" to="func.not_fn"></cxx-ref>
template <class F> unspecified not_fn(F&& f);
} // namespace fundamentals_v2
} // namespace experimental
template<class R, class... ArgTypes, class Alloc>
struct uses_allocator<experimental::function<R(ArgTypes...)>, Alloc>;
} // namespace std</code></pre>
</cxx-section>
<cxx-section id="func.wrap.func">
<h1>Class template <code>function</code></h1>
<cxx-ednote>
The following class template synopsis fixes the missing <code>noexcept</code> specification of the <code>nullptr_t</code> assignment operator
as recently resolved by <a href="http://cplusplus.github.io/LWG/lwg-active.html#2401">LWG 2401</a>.
We consider this change <em>editorial</em>, because the fundamentals-ts specification otherwise refers to a non-existing declaration in C++14.
</cxx-ednote>
<p>
The specification of all declarations within this sub-clause <cxx-ref to="func.wrap.func"></cxx-ref>
and its sub-clauses are the same as the corresponding declarations, as specified in <cxx-ref in="cxx" to="func.wrap.func"></cxx-ref>,
unless explicitly specified otherwise. <cxx-note><code>std::experimental::function</code> uses
<code>std::bad_function_call</code>, there is no additional type <code>std::experimental::bad_function_call</code></cxx-note>.
</p>
<pre><code>namespace std {
namespace experimental {
inline namespace fundamentals_v2 {
template<class> class function; <i>// undefined</i>
template<class R, class... ArgTypes>
class function<R(ArgTypes...)> {
public:
typedef R result_type;
typedef T1 argument_type;
typedef T1 first_argument_type;
typedef T2 second_argument_type;
typedef erased_type allocator_type;
function() noexcept;
function(nullptr_t) noexcept;
function(const function&);
function(function&&);
template<class F> function(F);
template<class A> function(allocator_arg_t, const A&) noexcept;
template<class A> function(allocator_arg_t, const A&,
nullptr_t) noexcept;
template<class A> function(allocator_arg_t, const A&,
const function&);
template<class A> function(allocator_arg_t, const A&,
function&&);
template<class F, class A> function(allocator_arg_t, const A&, F);
function& operator=(const function&);
function& operator=(function&&);
function& operator=(nullptr_t) noexcept;
template<class F> function& operator=(F&&);
template<class F> function& operator=(reference_wrapper<F>);
~function();
void swap(function&);
explicit operator bool() const noexcept;
R operator()(ArgTypes...) const;
const type_info& target_type() const noexcept;
template<class T> T* target() noexcept;
template<class T> const T* target() const noexcept;
pmr::memory_resource* get_memory_resource();
};
template <class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template <class R, class... ArgTypes>
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template <class R, class... ArgTypes>
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template <class R, class... ArgTypes>
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template <class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
} // namespace fundamentals_v2
} // namespace experimental
template <class R, class... ArgTypes, class Alloc>
struct uses_allocator<experimental::function<R(ArgTypes...)>, Alloc>
: true_type { };
} // namespace std</code></pre>
<cxx-section id="func.wrap.func.con">
<h1><code>function</code> construct/copy/destroy</h1>
<cxx-ednote>
The following first paragraph has been slightly editorially improved to
(a) make the difference between <code>std::function</code> and <code>std::experimental::function</code> clearer
(which seems necessary due to the "including" wording that can be parsed in two different ways) and
(b) to make intended normative wording clearer, that had been put into parenthesis before, by simply removing these parenthesis.
</cxx-ednote>
<p>
When a <code>function</code> constructor that takes a first argument of type <code>allocator_arg_t</code> is invoked,
the second argument is treated as a <cxx-term>type-erased allocator</cxx-term> (<cxx-ref to="memory.type.erased.allocator"></cxx-ref>).
If the constructor moves or makes a copy
of a function object (<cxx-ref in="cxx" to="function.objects"></cxx-ref>),
including an instance of the <code>experimental::function</code> class template,
then that move or copy is performed by <cxx-term>using-allocator construction</cxx-term> with allocator <code>get_memory_resource()</code>.
</p>
<p>
In the following descriptions, let <code><em>ALLOCATOR_OF</em>(f)</code> be the allocator specified in the construction of <code>function</code> <code>f</code>,
or <code>allocator<char>()</code> if no allocator was specified.
</p>
<cxx-function>
<cxx-signature>function& operator=(const function& f);</cxx-signature>
<cxx-effects><code>function(allocator_arg, <em>ALLOCATOR_OF</em>(*this), f).swap(*this);</code></cxx-effects>
<cxx-returns><code>*this</code>.</cxx-returns>
</cxx-function>
<cxx-function>
<cxx-signature>function& operator=(function&& f);</cxx-signature>
<cxx-effects><code>function(allocator_arg, <em>ALLOCATOR_OF</em>(*this), std::move(f)).swap(*this);</code></cxx-effects>
<cxx-returns><code>*this</code>.</cxx-returns>
</cxx-function>
<cxx-ednote>The following <i>Effects</i> element has been fixed and syncs the wording "<code>*this != NULL</code>"
with the C++14 working draft replacing it with "<code>*this != nullptr</code>"</cxx-ednote>
<cxx-function>
<cxx-signature>function& operator=(nullptr_t) noexcept;</cxx-signature>
<cxx-effects>If <code>*this != nullptr</code>, destroys the target of <code>this</code>.</cxx-effects>
<cxx-postconditions><code>!(*this)</code>.
The memory resource returned by <code>get_memory_resource()</code> after the assignment is equivalent to the memory resource before the assignment.
<cxx-note>the address returned by <code>get_memory_resource()</code> might change</cxx-note></cxx-postconditions>
<cxx-returns><code>*this</code>.</cxx-returns>
</cxx-function>
<cxx-function>
<cxx-signature>template<class F> function& operator=(F&& f);</cxx-signature>
<cxx-effects><code>function(allocator_arg, <em>ALLOCATOR_OF</em>(*this), std::forward<F>(f)).swap(*this);</code></cxx-effects>
<cxx-returns><code>*this</code>.</cxx-returns>
<cxx-remarks>This assignment operator shall not participate in overload resolution unless
<code>declval<decay_t<F>&>()</code> is Callable (<cxx-ref in="cxx" to="func.wrap.func"></cxx-ref>)
for argument types <code>ArgTypes...</code> and return type <code>R</code>.</cxx-remarks>
</cxx-function>
<cxx-function>
<cxx-signature>template<class F> function& operator=(reference_wrapper<F> f);</cxx-signature>
<cxx-effects><code>function(allocator_arg, <em>ALLOCATOR_OF</em>(*this), f).swap(*this);</code></cxx-effects>
<cxx-returns><code>*this</code>.</cxx-returns>
</cxx-function>
</cxx-section>
<cxx-section id="func.wrap.func.mod">
<h1><code>function</code> modifiers</h1>
<cxx-function>
<cxx-signature>void swap(function& other);</cxx-signature>
<cxx-requires><code>*this->get_memory_resource() == *other.get_memory_resource()</code>.</cxx-requires>
<cxx-effects>Interchanges the targets of <code>*this</code> and <code>other</code>.</cxx-effects>
<cxx-remarks>The allocators of <code>*this</code> and <code>other</code> are not interchanged.</cxx-remarks>
</cxx-function>
</cxx-section>
</cxx-section>
<cxx-section id="func.searchers">
<h1>Searchers</h1>
<p>
This sub-clause provides function object types (<cxx-ref in="cxx" to="function.objects"></cxx-ref>) for operations
that search for a sequence <cxx-range begin="pat_first" end="pat_last"></cxx-range> in another sequence <cxx-range begin="first" end="last"></cxx-range>
that is provided to the object's function call operator.
The first sequence (the pattern to be searched for) is provided to the object's constructor,
and the second (the sequence to be searched) is provided to the function call operator.
</p>
<p>
Each specialization of a class template specified in this sub-clause <cxx-ref to="func.searchers"></cxx-ref> shall meet the <code>CopyConstructible</code> and <code>CopyAssignable</code> requirements.
Template parameters named <code>ForwardIterator</code>, <code>ForwardIterator1</code>, <code>ForwardIterator2</code>, <code>RandomAccessIterator</code>, <code>RandomAccessIterator1</code>, <code>RandomAccessIterator2</code>, and <code>BinaryPredicate</code> of templates specified in this sub-clause <cxx-ref to="func.searchers"></cxx-ref> shall meet the same requirements and semantics as specified in <cxx-ref in="cxx" to="algorithms.general"></cxx-ref>.
Template parameters named <code>Hash</code> shall meet the requirements as specified in <cxx-ref in="cxx" to="hash.requirements"></cxx-ref>.
</p>
<p>
The Boyer-Moore searcher implements the Boyer-Moore search algorithm.
The Boyer-Moore-Horspool searcher implements the Boyer-Moore-Horspool search algorithm.
In general, the Boyer-Moore searcher will use more memory and give better run-time performance than Boyer-Moore-Horspool
</p>
<cxx-section id="func.searchers.default">
<h1>Class template <code>default_searcher</code></h1>
<pre><code>template<class ForwardIterator1, class BinaryPredicate = equal_to<>>
class default_searcher {
public:
default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
BinaryPredicate pred = BinaryPredicate());
template<class ForwardIterator2>
ForwardIterator2
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
private:
ForwardIterator1 pat_first_; <i>// exposition only</i>
ForwardIterator1 pat_last_; <i>// exposition only</i>
BinaryPredicate pred_; <i>// exposition only</i>
};
</code></pre>
<cxx-function>
<cxx-signature>default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
BinaryPredicate pred = BinaryPredicate());</cxx-signature>
<cxx-effects>Constructs a <code>default_searcher</code> object, initializing <code>pat_first_</code> with <code>pat_first</code>, <code>pat_last_</code> with <code>pat_last</code>, and <code>pred_</code> with <code>pred</code>.</cxx-effects>
<cxx-throws>Any exception thrown by the copy constructor of <code>BinaryPredicate</code> or <code>ForwardIterator1</code>.</cxx-throws>
</cxx-function>
<cxx-function>
<cxx-signature>template<class ForwardIterator2>
ForwardIterator2 operator()(ForwardIterator2 first, ForwardIterator2 last) const;</cxx-signature>
<cxx-effects>Equivalent to <code>return std::search(<w-br></w-br>first, last, pat_first_, pat_last_, pred_);</code></cxx-effects>
</cxx-function>
<cxx-section id="func.searchers.default.creation">
<h1><code>default_searcher</code> creation functions</h1>
<cxx-function>
<cxx-signature>template<class ForwardIterator, class BinaryPredicate = equal_to<>>
default_searcher<ForwardIterator, BinaryPredicate>
make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
BinaryPredicate pred = BinaryPredicate());</cxx-signature>
<cxx-effects>Equivalent to <code>return default_searcher<ForwardIterator, BinaryPredicate>(<w-br></w-br>pat_first, pat_last, pred);</code></cxx-effects>
</cxx-function>
</cxx-section>
</cxx-section>
<cxx-section id="func.searchers.boyer_moore">
<h1>Class template <code>boyer_moore_searcher</code></h1>
<pre><code>template<class RandomAccessIterator1,
class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_searcher {
public:
boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator2>
RandomAccessIterator2
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
private:
RandomAccessIterator1 pat_first_; <i>// exposition only</i>
RandomAccessIterator1 pat_last_; <i>// exposition only</i>
Hash hash_; <i>// exposition only</i>
BinaryPredicate pred_; <i>// exposition only</i>
};
</code></pre>
<cxx-function>
<cxx-signature>boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
Hash hf = Hash(),
BinaryPredicate pred = BinaryPredicate());</cxx-signature>
<cxx-requires>The value type of <code>RandomAccessIterator1</code> shall meet the <code>DefaultConstructible</code>, <code>CopyConstructible</code>, and <code>CopyAssignable</code> requirements.</cxx-requires>
<cxx-requires>For any two values <code>A</code> and <code>B</code> of the type <code>iterator_traits<RandomAccessIterator1>::value_type</code>, if <code>pred(A,B)==true</code>, then <code>hf(A)==hf(B)</code> shall be true.</cxx-requires>
<cxx-effects>Constructs a <code>boyer_moore_searcher</code> object, initializing <code>pat_first_</code> with <code>pat_first</code>, <code>pat_last_</code> with <code>pat_last</code>, <code>hash_</code> with <code>hf</code>, and <code>pred_</code> with <code>pred</code>.</cxx-effects>
<cxx-throws>Any exception thrown by the copy constructor of <code>RandomAccessIterator1</code>,
or by the default constructor, copy constructor, or the copy assignment operator of the value type of <code>RandomAccessIterator1</code>,
or the copy constructor or <code>operator()</code> of <code>BinaryPredicate</code> or <code>Hash</code>.
May throw <code>bad_alloc</code> if additional memory needed for internal data structures cannot be allocated.</cxx-throws>
</cxx-function>
<cxx-function>
<cxx-signature>template<class RandomAccessIterator2>
RandomAccessIterator2 operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;</cxx-signature>
<cxx-requires><code>RandomAccessIterator1</code> and <code>RandomAccessIterator2</code> shall have the same value type.</cxx-requires>
<cxx-effects>Finds a subsequence of equal values in a sequence.</cxx-effects>
<cxx-returns>
The first iterator <code>i</code> in the range <cxx-range begin="first" end="last - (pat_last_ - pat_first_)"></cxx-range>
such that for every non-negative integer <code>n</code> less than <code>pat_last_ - pat_first_</code> the following condition holds:
<code>pred(*(i + n), *(pat_first_ + n)) != false</code>.
Returns <code>first</code> if <cxx-range begin="pat_first_" end="pat_last_"></cxx-range> is empty,
otherwise returns <code>last</code> if no such iterator is found.
</cxx-returns>
<cxx-complexity>At most <code>(last - first) * (pat_last_ - pat_first_)</code> applications of the predicate.</cxx-complexity>
</cxx-function>
<cxx-section id="func.searchers.boyer_moore.creation">
<h1><code>boyer_moore_searcher</code> creation functions</h1>
<cxx-function>
<cxx-signature>template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_searcher(RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());</cxx-signature>
<cxx-effects>Equivalent to <code>return boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>(<w-br></w-br>pat_first, pat_last, hf, pred);</code></cxx-effects>
</cxx-function>
</cxx-section>
</cxx-section>
<cxx-section id="func.searchers.boyer_moore_horspool">
<h1>Class template <code>boyer_moore_horspool_searcher</code></h1>
<pre><code>
template<class RandomAccessIterator1,
class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher {
public:
boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator2>
RandomAccessIterator2
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
private:
RandomAccessIterator1 pat_first_; <i>// exposition only</i>
RandomAccessIterator1 pat_last_; <i>// exposition only</i>
Hash hash_; <i>// exposition only</i>
BinaryPredicate pred_; <i>// exposition only</i>
};
</code></pre>
<cxx-function>
<cxx-signature>boyer_moore_horspool_searcher(
RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());</cxx-signature>
<cxx-requires>The value type of <code>RandomAccessIterator1</code> shall meet the <code>DefaultConstructible</code>, <code>CopyConstructible</code>, and <code>CopyAssignable</code> requirements.</cxx-requires>
<cxx-requires>For any two values <code>A</code> and <code>B</code> of the type <code>iterator_traits<RandomAccessIterator1>::value_type</code>,
if <code>pred(A,B)==true</code>, then <code>hf(A)==hf(B)</code> shall be true.</cxx-requires>
<cxx-effects>Constructs a <code>boyer_moore_horspool_searcher</code> object, initializing <code>pat_first_</code> with <code>pat_first</code>,
<code>pat_last_</code> with <code>pat_last</code>, <code>hash_</code> with <code>hf</code>, and <code>pred_</code> with <code>pred</code>.</cxx-effects>
<cxx-throws>
Any exception thrown by the copy constructor of <code>RandomAccessIterator1</code>,
or by the default constructor, copy constructor, or the copy assignment operator of the value type of <code>RandomAccessIterator1</code>
or the copy constructor or <code>operator()</code> of <code>BinaryPredicate</code> or <code>Hash</code>.
May throw <code>bad_alloc</code> if additional memory needed for internal data structures cannot be allocated..
</cxx-throws>
</cxx-function>
<cxx-function>
<cxx-signature>template<class RandomAccessIterator2>
RandomAccessIterator2 operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;</cxx-signature>
<cxx-requires><code>RandomAccessIterator1</code> and <code>RandomAccessIterator2</code> shall have the same value type.</cxx-requires>
<cxx-effects>Finds a subsequence of equal values in a sequence.</cxx-effects>
<cxx-returns>
The first iterator <code>i</code> in the range <cxx-range begin="first" end="last - (pat_last_ - pat_first_)"></cxx-range>
such that for every non-negative integer <code>n</code> less than <code>pat_last_ - pat_first_</code> the following condition holds:
<code>pred(*(i + n), *(pat_first_ + n)) != false</code>.
Returns <code>first</code> if <cxx-range begin="pat_first_" end="pat_last_"></cxx-range> is empty,
otherwise returns <code>last</code> if no such iterator is found.
</cxx-returns>
<cxx-complexity>At most <code>(last - first) * (pat_last_ - pat_first_)</code> applications of the predicate.</cxx-complexity>
</cxx-function>
<cxx-section id="func.searchers.boyer_moore_horspool.creation">
<h1><code>boyer_moore_horspool_searcher</code> creation functions</h1>
<cxx-function>
<cxx-signature>template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_horspool_searcher(
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());</cxx-signature>
<cxx-effects>Equivalent to <code>return boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>(<w-br></w-br>pat_first, pat_last, hf, pred);</code></cxx-effects>
</cxx-function>
</cxx-section>
</cxx-section>
</cxx-section>
<cxx-section id="func.not_fn">
<h1>Function template <code>not_fn</code></h1>
<cxx-function>
<cxx-signature>template <class F> <em>unspecified</em> not_fn(F&& f);</cxx-signature>
<p>In the text that follows:</p>
<ul>
<li><code>FD</code> is the type <code>decay_t<F></code>,</li>
<li><code>fd</code> is an lvalue of type <code>FD</code> constructed from <code>std::forward<F>(f),</code></li>
<li><code>fn</code> is a forwarding call wrapper created as a result of <code>not_fn(f)</code>,</li>
</ul>
<cxx-requires>
<code>is_constructible<FD, F>::value</code> shall be <code>true</code>.
<code>fd</code> shall be a callable object (<cxx-ref in="cxx" to="func.def"></cxx-ref>).
</cxx-requires>
<cxx-returns>
A forwarding call wrapper <code>fn</code> such that the expression <code>fn(a1, a2, ..., aN)</code>
is equivalent to <code>!<em>INVOKE</em>(fd, a1, a2, ..., aN)</code> (<cxx-ref in="cxx" to="func.require"></cxx-ref>).
</cxx-returns>
<cxx-throws>Nothing unless the construction of <code>fd</code> throws an exception.</cxx-throws>
<cxx-remarks>
The return type shall satisfy the requirements of <code>MoveConstructible</code>.
If <code>FD</code> satisfies the requirements of <code>CopyConstructible</code>, then
the return type shall satisfy the requirements of <code>CopyConstructible</code>.
<cxx-note>This implies that <code>FD</code> is MoveConstructible.</cxx-note>
</cxx-remarks>
<p><cxx-note>Function template <code>not_fn</code> can usually provide a better solution than using the negators <code>not1</code> and <code>not2</code></cxx-note></p>
</cxx-function>
</cxx-section>
</cxx-clause>