blob: 05d42fcff232e36eed16ff58981881618d2dacb1 [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001// -*- C++ -*-
Kaido Kert788710a2023-06-05 07:50:22 -07002//===----------------------------------------------------------------------===//
Andrew Top61a84952019-04-30 15:07:33 -07003//
Kaido Kert788710a2023-06-05 07:50:22 -07004// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Andrew Top61a84952019-04-30 15:07:33 -07007//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_FUNCTIONAL
11#define _LIBCPP_FUNCTIONAL
12
13/*
14 functional synopsis
15
16namespace std
17{
18
19template <class Arg, class Result>
20struct unary_function
21{
22 typedef Arg argument_type;
23 typedef Result result_type;
24};
25
26template <class Arg1, class Arg2, class Result>
27struct binary_function
28{
29 typedef Arg1 first_argument_type;
30 typedef Arg2 second_argument_type;
31 typedef Result result_type;
32};
33
34template <class T>
35class reference_wrapper
36 : public unary_function<T1, R> // if wrapping a unary functor
37 : public binary_function<T1, T2, R> // if wraping a binary functor
38{
39public:
40 // types
41 typedef T type;
42 typedef see below result_type; // Not always defined
43
44 // construct/copy/destroy
Kaido Kert788710a2023-06-05 07:50:22 -070045 template<class U>
Kaido Kert56d7c4e2024-04-13 12:59:27 -070046 constexpr reference_wrapper(U&&); // constexpr since C++20
47 constexpr reference_wrapper(const reference_wrapper<T>& x) noexcept; // constexpr since C++20
Andrew Top61a84952019-04-30 15:07:33 -070048
49 // assignment
Kaido Kert56d7c4e2024-04-13 12:59:27 -070050 constexpr reference_wrapper&
51 operator=(const reference_wrapper<T>& x) noexcept; // constexpr since C++20
Andrew Top61a84952019-04-30 15:07:33 -070052
53 // access
Kaido Kert56d7c4e2024-04-13 12:59:27 -070054 constexpr operator T& () const noexcept; // constexpr since C++20
55 constexpr T& get() const noexcept; // constexpr since C++20
Andrew Top61a84952019-04-30 15:07:33 -070056
57 // invoke
58 template <class... ArgTypes>
Kaido Kert56d7c4e2024-04-13 12:59:27 -070059 constexpr typename result_of<T&(ArgTypes&&...)>::type // constexpr since C++20
60 operator() (ArgTypes&&...) const
61 noexcept(is_nothrow_invocable_v<T&, ArgTypes...>); // noexcept since C++17
Andrew Top61a84952019-04-30 15:07:33 -070062};
63
Kaido Kert788710a2023-06-05 07:50:22 -070064template <class T>
65 reference_wrapper(T&) -> reference_wrapper<T>;
66
Andrew Top61a84952019-04-30 15:07:33 -070067template <class T> reference_wrapper<T> ref(T& t) noexcept;
68template <class T> void ref(const T&& t) = delete;
69template <class T> reference_wrapper<T> ref(reference_wrapper<T>t) noexcept;
70
71template <class T> reference_wrapper<const T> cref(const T& t) noexcept;
72template <class T> void cref(const T&& t) = delete;
73template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
74
Kaido Kert788710a2023-06-05 07:50:22 -070075template <class T> struct unwrap_reference; // since C++20
76template <class T> struct unwrap_ref_decay : unwrap_reference<decay_t<T>> { }; // since C++20
77template <class T> using unwrap_reference_t = typename unwrap_reference<T>::type; // since C++20
78template <class T> using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type; // since C++20
79
Andrew Top61a84952019-04-30 15:07:33 -070080template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -070081struct plus {
Andrew Top61a84952019-04-30 15:07:33 -070082 T operator()(const T& x, const T& y) const;
83};
84
85template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -070086struct minus {
Andrew Top61a84952019-04-30 15:07:33 -070087 T operator()(const T& x, const T& y) const;
88};
89
90template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -070091struct multiplies {
Andrew Top61a84952019-04-30 15:07:33 -070092 T operator()(const T& x, const T& y) const;
93};
94
95template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -070096struct divides {
Andrew Top61a84952019-04-30 15:07:33 -070097 T operator()(const T& x, const T& y) const;
98};
99
100template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700101struct modulus {
Andrew Top61a84952019-04-30 15:07:33 -0700102 T operator()(const T& x, const T& y) const;
103};
104
105template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700106struct negate {
Andrew Top61a84952019-04-30 15:07:33 -0700107 T operator()(const T& x) const;
108};
109
110template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700111struct equal_to {
Andrew Top61a84952019-04-30 15:07:33 -0700112 bool operator()(const T& x, const T& y) const;
113};
114
115template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700116struct not_equal_to {
Andrew Top61a84952019-04-30 15:07:33 -0700117 bool operator()(const T& x, const T& y) const;
118};
119
120template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700121struct greater {
Andrew Top61a84952019-04-30 15:07:33 -0700122 bool operator()(const T& x, const T& y) const;
123};
124
125template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700126struct less {
Andrew Top61a84952019-04-30 15:07:33 -0700127 bool operator()(const T& x, const T& y) const;
128};
129
130template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700131struct greater_equal {
Andrew Top61a84952019-04-30 15:07:33 -0700132 bool operator()(const T& x, const T& y) const;
133};
134
135template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700136struct less_equal {
137 bool operator()(const T& x, const T& y) const;
138};
139
140// [comparisons.three.way], class compare_three_way
141struct compare_three_way;
142
143template <class T> // <class T=void> in C++14
144struct logical_and {
Andrew Top61a84952019-04-30 15:07:33 -0700145 bool operator()(const T& x, const T& y) const;
146};
147
148template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700149struct logical_or {
Andrew Top61a84952019-04-30 15:07:33 -0700150 bool operator()(const T& x, const T& y) const;
151};
152
153template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700154struct logical_not {
Andrew Top61a84952019-04-30 15:07:33 -0700155 bool operator()(const T& x) const;
156};
157
158template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700159struct bit_and {
160 T operator()(const T& x, const T& y) const;
Andrew Top61a84952019-04-30 15:07:33 -0700161};
162
163template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700164struct bit_or {
165 T operator()(const T& x, const T& y) const;
Andrew Top61a84952019-04-30 15:07:33 -0700166};
167
168template <class T> // <class T=void> in C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700169struct bit_xor {
170 T operator()(const T& x, const T& y) const;
Andrew Top61a84952019-04-30 15:07:33 -0700171};
172
173template <class T=void> // C++14
Kaido Kert788710a2023-06-05 07:50:22 -0700174struct bit_not {
175 T operator()(const T& x) const;
Andrew Top61a84952019-04-30 15:07:33 -0700176};
177
Kaido Kert788710a2023-06-05 07:50:22 -0700178struct identity; // C++20
179
Andrew Top61a84952019-04-30 15:07:33 -0700180template <class Predicate>
Kaido Kert788710a2023-06-05 07:50:22 -0700181class unary_negate // deprecated in C++17, removed in C++20
Andrew Top61a84952019-04-30 15:07:33 -0700182 : public unary_function<typename Predicate::argument_type, bool>
183{
184public:
185 explicit unary_negate(const Predicate& pred);
186 bool operator()(const typename Predicate::argument_type& x) const;
187};
188
Kaido Kert788710a2023-06-05 07:50:22 -0700189template <class Predicate> // deprecated in C++17, removed in C++20
190unary_negate<Predicate> not1(const Predicate& pred);
Andrew Top61a84952019-04-30 15:07:33 -0700191
192template <class Predicate>
Kaido Kert788710a2023-06-05 07:50:22 -0700193class binary_negate // deprecated in C++17, removed in C++20
Andrew Top61a84952019-04-30 15:07:33 -0700194 : public binary_function<typename Predicate::first_argument_type,
195 typename Predicate::second_argument_type,
196 bool>
197{
198public:
199 explicit binary_negate(const Predicate& pred);
200 bool operator()(const typename Predicate::first_argument_type& x,
201 const typename Predicate::second_argument_type& y) const;
202};
203
Kaido Kert788710a2023-06-05 07:50:22 -0700204template <class Predicate> // deprecated in C++17, removed in C++20
205binary_negate<Predicate> not2(const Predicate& pred);
Andrew Top61a84952019-04-30 15:07:33 -0700206
Kaido Kert788710a2023-06-05 07:50:22 -0700207template <class F>
208constexpr unspecified not_fn(F&& f); // C++17, constexpr in C++20
Andrew Top61a84952019-04-30 15:07:33 -0700209
210template<class T> struct is_bind_expression;
211template<class T> struct is_placeholder;
212
213 // See C++14 20.9.9, Function object binders
214template <class T> inline constexpr bool is_bind_expression_v
215 = is_bind_expression<T>::value; // C++17
216template <class T> inline constexpr int is_placeholder_v
217 = is_placeholder<T>::value; // C++17
218
219
220template<class Fn, class... BoundArgs>
Kaido Kert788710a2023-06-05 07:50:22 -0700221 constexpr unspecified bind(Fn&&, BoundArgs&&...); // constexpr in C++20
Andrew Top61a84952019-04-30 15:07:33 -0700222template<class R, class Fn, class... BoundArgs>
Kaido Kert788710a2023-06-05 07:50:22 -0700223 constexpr unspecified bind(Fn&&, BoundArgs&&...); // constexpr in C++20
224
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700225// [func.invoke]
Kaido Kert788710a2023-06-05 07:50:22 -0700226template<class F, class... Args>
227 constexpr // constexpr in C++20
228 invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17
229 noexcept(is_nothrow_invocable_v<F, Args...>);
Andrew Top61a84952019-04-30 15:07:33 -0700230
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700231template<class R, class F, class... Args>
232 constexpr R invoke_r(F&& f, Args&&... args) // C++23
233 noexcept(is_nothrow_invocable_r_v<R, F, Args...>);
234
Andrew Top61a84952019-04-30 15:07:33 -0700235namespace placeholders {
236 // M is the implementation-defined number of placeholders
237 extern unspecified _1;
238 extern unspecified _2;
239 .
240 .
241 .
242 extern unspecified _Mp;
243}
244
245template <class Operation>
246class binder1st // deprecated in C++11, removed in C++17
247 : public unary_function<typename Operation::second_argument_type,
248 typename Operation::result_type>
249{
250protected:
251 Operation op;
252 typename Operation::first_argument_type value;
253public:
254 binder1st(const Operation& x, const typename Operation::first_argument_type y);
255 typename Operation::result_type operator()( typename Operation::second_argument_type& x) const;
256 typename Operation::result_type operator()(const typename Operation::second_argument_type& x) const;
257};
258
259template <class Operation, class T>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700260binder1st<Operation> bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700261
262template <class Operation>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700263class binder2nd // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700264 : public unary_function<typename Operation::first_argument_type,
265 typename Operation::result_type>
266{
267protected:
268 Operation op;
269 typename Operation::second_argument_type value;
270public:
271 binder2nd(const Operation& x, const typename Operation::second_argument_type y);
272 typename Operation::result_type operator()( typename Operation::first_argument_type& x) const;
273 typename Operation::result_type operator()(const typename Operation::first_argument_type& x) const;
274};
275
276template <class Operation, class T>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700277binder2nd<Operation> bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700278
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700279template <class Arg, class Result> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700280class pointer_to_unary_function : public unary_function<Arg, Result>
281{
282public:
283 explicit pointer_to_unary_function(Result (*f)(Arg));
284 Result operator()(Arg x) const;
285};
286
287template <class Arg, class Result>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700288pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700289
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700290template <class Arg1, class Arg2, class Result> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700291class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result>
292{
293public:
294 explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2));
295 Result operator()(Arg1 x, Arg2 y) const;
296};
297
298template <class Arg1, class Arg2, class Result>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700299pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700300
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700301template<class S, class T> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700302class mem_fun_t : public unary_function<T*, S>
303{
304public:
305 explicit mem_fun_t(S (T::*p)());
306 S operator()(T* p) const;
307};
308
309template<class S, class T, class A>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700310class mem_fun1_t : public binary_function<T*, A, S> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700311{
312public:
313 explicit mem_fun1_t(S (T::*p)(A));
314 S operator()(T* p, A x) const;
315};
316
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700317template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17
318template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700319
320template<class S, class T>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700321class mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700322{
323public:
324 explicit mem_fun_ref_t(S (T::*p)());
325 S operator()(T& p) const;
326};
327
328template<class S, class T, class A>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700329class mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700330{
331public:
332 explicit mem_fun1_ref_t(S (T::*p)(A));
333 S operator()(T& p, A x) const;
334};
335
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700336template<class S, class T>
337mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17
338template<class S, class T, class A>
339mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700340
341template <class S, class T>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700342class const_mem_fun_t : public unary_function<const T*, S> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700343{
344public:
345 explicit const_mem_fun_t(S (T::*p)() const);
346 S operator()(const T* p) const;
347};
348
349template <class S, class T, class A>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700350class const_mem_fun1_t : public binary_function<const T*, A, S> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700351{
352public:
353 explicit const_mem_fun1_t(S (T::*p)(A) const);
354 S operator()(const T* p, A x) const;
355};
356
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700357template <class S, class T>
358const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17
359template <class S, class T, class A>
360const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700361
362template <class S, class T>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700363class const_mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700364{
365public:
366 explicit const_mem_fun_ref_t(S (T::*p)() const);
367 S operator()(const T& p) const;
368};
369
370template <class S, class T, class A>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700371class const_mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700372{
373public:
374 explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
375 S operator()(const T& p, A x) const;
376};
377
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700378template <class S, class T>
379const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17
380template <class S, class T, class A>
381const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
Andrew Top61a84952019-04-30 15:07:33 -0700382
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700383template<class R, class T> constexpr unspecified mem_fn(R T::*); // constexpr in C++20
Andrew Top61a84952019-04-30 15:07:33 -0700384
385class bad_function_call
386 : public exception
387{
388};
389
390template<class> class function; // undefined
391
392template<class R, class... ArgTypes>
393class function<R(ArgTypes...)>
394 : public unary_function<T1, R> // iff sizeof...(ArgTypes) == 1 and
395 // ArgTypes contains T1
396 : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
397 // ArgTypes contains T1 and T2
398{
399public:
400 typedef R result_type;
401
402 // construct/copy/destroy:
403 function() noexcept;
404 function(nullptr_t) noexcept;
405 function(const function&);
406 function(function&&) noexcept;
407 template<class F>
408 function(F);
409 template<Allocator Alloc>
410 function(allocator_arg_t, const Alloc&) noexcept; // removed in C++17
411 template<Allocator Alloc>
412 function(allocator_arg_t, const Alloc&, nullptr_t) noexcept; // removed in C++17
413 template<Allocator Alloc>
414 function(allocator_arg_t, const Alloc&, const function&); // removed in C++17
415 template<Allocator Alloc>
416 function(allocator_arg_t, const Alloc&, function&&); // removed in C++17
417 template<class F, Allocator Alloc>
418 function(allocator_arg_t, const Alloc&, F); // removed in C++17
419
420 function& operator=(const function&);
421 function& operator=(function&&) noexcept;
422 function& operator=(nullptr_t) noexcept;
423 template<class F>
424 function& operator=(F&&);
425 template<class F>
426 function& operator=(reference_wrapper<F>) noexcept;
427
428 ~function();
429
430 // function modifiers:
431 void swap(function&) noexcept;
432 template<class F, class Alloc>
433 void assign(F&&, const Alloc&); // Removed in C++17
434
435 // function capacity:
436 explicit operator bool() const noexcept;
437
438 // function invocation:
439 R operator()(ArgTypes...) const;
440
441 // function target access:
442 const std::type_info& target_type() const noexcept;
443 template <typename T> T* target() noexcept;
444 template <typename T> const T* target() const noexcept;
445};
446
Kaido Kert788710a2023-06-05 07:50:22 -0700447// Deduction guides
448template<class R, class ...Args>
449function(R(*)(Args...)) -> function<R(Args...)>; // since C++17
450
451template<class F>
452function(F) -> function<see-below>; // since C++17
453
Andrew Top61a84952019-04-30 15:07:33 -0700454// Null pointer comparisons:
455template <class R, class ... ArgTypes>
456 bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
457
458template <class R, class ... ArgTypes>
459 bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
460
461template <class R, class ... ArgTypes>
462 bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
463
464template <class R, class ... ArgTypes>
465 bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
466
467// specialized algorithms:
468template <class R, class ... ArgTypes>
469 void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
470
471template <class T> struct hash;
472
473template <> struct hash<bool>;
474template <> struct hash<char>;
475template <> struct hash<signed char>;
476template <> struct hash<unsigned char>;
Kaido Kert788710a2023-06-05 07:50:22 -0700477template <> struct hash<char8_t>; // since C++20
Andrew Top61a84952019-04-30 15:07:33 -0700478template <> struct hash<char16_t>;
479template <> struct hash<char32_t>;
480template <> struct hash<wchar_t>;
481template <> struct hash<short>;
482template <> struct hash<unsigned short>;
483template <> struct hash<int>;
484template <> struct hash<unsigned int>;
485template <> struct hash<long>;
486template <> struct hash<long long>;
487template <> struct hash<unsigned long>;
488template <> struct hash<unsigned long long>;
489
490template <> struct hash<float>;
491template <> struct hash<double>;
492template <> struct hash<long double>;
493
494template<class T> struct hash<T*>;
495template <> struct hash<nullptr_t>; // C++17
496
Kaido Kert788710a2023-06-05 07:50:22 -0700497namespace ranges {
498 // [range.cmp], concept-constrained comparisons
499 struct equal_to;
500 struct not_equal_to;
501 struct greater;
502 struct less;
503 struct greater_equal;
504 struct less_equal;
505}
506
Andrew Top61a84952019-04-30 15:07:33 -0700507} // std
508
509POLICY: For non-variadic implementations, the number of arguments is limited
510 to 3. It is hoped that the need for non-variadic implementations
511 will be minimal.
512
513*/
514
Kaido Kert788710a2023-06-05 07:50:22 -0700515#include <__algorithm/search.h>
516#include <__assert> // all public C++ headers provide the assertion handler
517#include <__compare/compare_three_way.h>
Andrew Top61a84952019-04-30 15:07:33 -0700518#include <__config>
Kaido Kert788710a2023-06-05 07:50:22 -0700519#include <__debug>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700520#include <__functional/binary_function.h>
Kaido Kert788710a2023-06-05 07:50:22 -0700521#include <__functional/binary_negate.h>
522#include <__functional/bind.h>
523#include <__functional/bind_back.h>
524#include <__functional/bind_front.h>
525#include <__functional/binder1st.h>
526#include <__functional/binder2nd.h>
527#include <__functional/boyer_moore_searcher.h>
528#include <__functional/compose.h>
529#include <__functional/default_searcher.h>
530#include <__functional/function.h>
531#include <__functional/hash.h>
532#include <__functional/identity.h>
533#include <__functional/invoke.h>
534#include <__functional/mem_fn.h> // TODO: deprecate
535#include <__functional/mem_fun_ref.h>
536#include <__functional/not_fn.h>
537#include <__functional/operations.h>
538#include <__functional/pointer_to_binary_function.h>
539#include <__functional/pointer_to_unary_function.h>
540#include <__functional/ranges_operations.h>
541#include <__functional/reference_wrapper.h>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700542#include <__functional/unary_function.h>
Kaido Kert788710a2023-06-05 07:50:22 -0700543#include <__functional/unary_negate.h>
544#include <__functional/unwrap_ref.h>
545#include <__utility/forward.h>
Kaido Kert788710a2023-06-05 07:50:22 -0700546#include <memory> // TODO: find out why removing this breaks the modules build
Andrew Top61a84952019-04-30 15:07:33 -0700547#include <typeinfo>
Kaido Kert788710a2023-06-05 07:50:22 -0700548#include <version>
Andrew Top61a84952019-04-30 15:07:33 -0700549
550#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Kaido Kert788710a2023-06-05 07:50:22 -0700551# pragma GCC system_header
Andrew Top61a84952019-04-30 15:07:33 -0700552#endif
553
Kaido Kert788710a2023-06-05 07:50:22 -0700554#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700555# include <atomic>
Kaido Kert788710a2023-06-05 07:50:22 -0700556# include <concepts>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700557# include <cstdlib>
558# include <exception>
Kaido Kert788710a2023-06-05 07:50:22 -0700559# include <tuple>
Kaido Kert56d7c4e2024-04-13 12:59:27 -0700560# include <type_traits>
Kaido Kert788710a2023-06-05 07:50:22 -0700561# include <utility>
Andrew Top61a84952019-04-30 15:07:33 -0700562#endif
563
Kaido Kert788710a2023-06-05 07:50:22 -0700564#endif // _LIBCPP_FUNCTIONAL