xref: /openbsd-src/gnu/llvm/libcxx/include/functional (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
146035553Spatrick// -*- C++ -*-
276d0caaeSpatrick//===----------------------------------------------------------------------===//
346035553Spatrick//
446035553Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
546035553Spatrick// See https://llvm.org/LICENSE.txt for license information.
646035553Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
746035553Spatrick//
846035553Spatrick//===----------------------------------------------------------------------===//
946035553Spatrick
1046035553Spatrick#ifndef _LIBCPP_FUNCTIONAL
1146035553Spatrick#define _LIBCPP_FUNCTIONAL
1246035553Spatrick
1346035553Spatrick/*
1446035553Spatrick    functional synopsis
1546035553Spatrick
1646035553Spatricknamespace std
1746035553Spatrick{
1846035553Spatrick
1946035553Spatricktemplate <class Arg, class Result>
2046035553Spatrickstruct unary_function
2146035553Spatrick{
2246035553Spatrick    typedef Arg    argument_type;
2346035553Spatrick    typedef Result result_type;
2446035553Spatrick};
2546035553Spatrick
2646035553Spatricktemplate <class Arg1, class Arg2, class Result>
2746035553Spatrickstruct binary_function
2846035553Spatrick{
2946035553Spatrick    typedef Arg1   first_argument_type;
3046035553Spatrick    typedef Arg2   second_argument_type;
3146035553Spatrick    typedef Result result_type;
3246035553Spatrick};
3346035553Spatrick
3446035553Spatricktemplate <class T>
3546035553Spatrickclass reference_wrapper
3646035553Spatrick    : public unary_function<T1, R> // if wrapping a unary functor
3746035553Spatrick    : public binary_function<T1, T2, R> // if wraping a binary functor
3846035553Spatrick{
3946035553Spatrickpublic:
4046035553Spatrick    // types
4146035553Spatrick    typedef T type;
4246035553Spatrick    typedef see below result_type; // Not always defined
4346035553Spatrick
4446035553Spatrick    // construct/copy/destroy
4576d0caaeSpatrick    template<class U>
4676d0caaeSpatrick      reference_wrapper(U&&);
4746035553Spatrick    reference_wrapper(const reference_wrapper<T>& x) noexcept;
4846035553Spatrick
4946035553Spatrick    // assignment
5046035553Spatrick    reference_wrapper& operator=(const reference_wrapper<T>& x) noexcept;
5146035553Spatrick
5246035553Spatrick    // access
5346035553Spatrick    operator T& () const noexcept;
5446035553Spatrick    T& get() const noexcept;
5546035553Spatrick
5646035553Spatrick    // invoke
5746035553Spatrick    template <class... ArgTypes>
5846035553Spatrick      typename result_of<T&(ArgTypes&&...)>::type
5946035553Spatrick          operator() (ArgTypes&&...) const;
6046035553Spatrick};
6146035553Spatrick
6276d0caaeSpatricktemplate <class T>
6376d0caaeSpatrick  reference_wrapper(T&) -> reference_wrapper<T>;
6476d0caaeSpatrick
6546035553Spatricktemplate <class T> reference_wrapper<T> ref(T& t) noexcept;
6646035553Spatricktemplate <class T> void ref(const T&& t) = delete;
6746035553Spatricktemplate <class T> reference_wrapper<T> ref(reference_wrapper<T>t) noexcept;
6846035553Spatrick
6946035553Spatricktemplate <class T> reference_wrapper<const T> cref(const T& t) noexcept;
7046035553Spatricktemplate <class T> void cref(const T&& t) = delete;
7146035553Spatricktemplate <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
7246035553Spatrick
7346035553Spatricktemplate <class T> struct unwrap_reference;                                       // since C++20
7446035553Spatricktemplate <class T> struct unwrap_ref_decay : unwrap_reference<decay_t<T>> { };    // since C++20
7546035553Spatricktemplate <class T> using unwrap_reference_t = typename unwrap_reference<T>::type; // since C++20
7646035553Spatricktemplate <class T> using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type; // since C++20
7746035553Spatrick
7846035553Spatricktemplate <class T> // <class T=void> in C++14
7976d0caaeSpatrickstruct plus {
8046035553Spatrick    T operator()(const T& x, const T& y) const;
8146035553Spatrick};
8246035553Spatrick
8346035553Spatricktemplate <class T> // <class T=void> in C++14
8476d0caaeSpatrickstruct minus {
8546035553Spatrick    T operator()(const T& x, const T& y) const;
8646035553Spatrick};
8746035553Spatrick
8846035553Spatricktemplate <class T> // <class T=void> in C++14
8976d0caaeSpatrickstruct multiplies {
9046035553Spatrick    T operator()(const T& x, const T& y) const;
9146035553Spatrick};
9246035553Spatrick
9346035553Spatricktemplate <class T> // <class T=void> in C++14
9476d0caaeSpatrickstruct divides {
9546035553Spatrick    T operator()(const T& x, const T& y) const;
9646035553Spatrick};
9746035553Spatrick
9846035553Spatricktemplate <class T> // <class T=void> in C++14
9976d0caaeSpatrickstruct modulus {
10046035553Spatrick    T operator()(const T& x, const T& y) const;
10146035553Spatrick};
10246035553Spatrick
10346035553Spatricktemplate <class T> // <class T=void> in C++14
10476d0caaeSpatrickstruct negate {
10546035553Spatrick    T operator()(const T& x) const;
10646035553Spatrick};
10746035553Spatrick
10846035553Spatricktemplate <class T> // <class T=void> in C++14
10976d0caaeSpatrickstruct equal_to {
11046035553Spatrick    bool operator()(const T& x, const T& y) const;
11146035553Spatrick};
11246035553Spatrick
11346035553Spatricktemplate <class T> // <class T=void> in C++14
11476d0caaeSpatrickstruct not_equal_to {
11546035553Spatrick    bool operator()(const T& x, const T& y) const;
11646035553Spatrick};
11746035553Spatrick
11846035553Spatricktemplate <class T> // <class T=void> in C++14
11976d0caaeSpatrickstruct greater {
12046035553Spatrick    bool operator()(const T& x, const T& y) const;
12146035553Spatrick};
12246035553Spatrick
12346035553Spatricktemplate <class T> // <class T=void> in C++14
12476d0caaeSpatrickstruct less {
12546035553Spatrick    bool operator()(const T& x, const T& y) const;
12646035553Spatrick};
12746035553Spatrick
12846035553Spatricktemplate <class T> // <class T=void> in C++14
12976d0caaeSpatrickstruct greater_equal {
13046035553Spatrick    bool operator()(const T& x, const T& y) const;
13146035553Spatrick};
13246035553Spatrick
13346035553Spatricktemplate <class T> // <class T=void> in C++14
13476d0caaeSpatrickstruct less_equal {
13546035553Spatrick    bool operator()(const T& x, const T& y) const;
13646035553Spatrick};
13746035553Spatrick
138*4bdff4beSrobert// [comparisons.three.way], class compare_three_way
139*4bdff4beSrobertstruct compare_three_way;
140*4bdff4beSrobert
14146035553Spatricktemplate <class T> // <class T=void> in C++14
14276d0caaeSpatrickstruct logical_and {
14346035553Spatrick    bool operator()(const T& x, const T& y) const;
14446035553Spatrick};
14546035553Spatrick
14646035553Spatricktemplate <class T> // <class T=void> in C++14
14776d0caaeSpatrickstruct logical_or {
14846035553Spatrick    bool operator()(const T& x, const T& y) const;
14946035553Spatrick};
15046035553Spatrick
15146035553Spatricktemplate <class T> // <class T=void> in C++14
15276d0caaeSpatrickstruct logical_not {
15346035553Spatrick    bool operator()(const T& x) const;
15446035553Spatrick};
15546035553Spatrick
15646035553Spatricktemplate <class T> // <class T=void> in C++14
15776d0caaeSpatrickstruct bit_and {
15876d0caaeSpatrick    T operator()(const T& x, const T& y) const;
15946035553Spatrick};
16046035553Spatrick
16146035553Spatricktemplate <class T> // <class T=void> in C++14
16276d0caaeSpatrickstruct bit_or {
16376d0caaeSpatrick    T operator()(const T& x, const T& y) const;
16446035553Spatrick};
16546035553Spatrick
16646035553Spatricktemplate <class T> // <class T=void> in C++14
16776d0caaeSpatrickstruct bit_xor {
16876d0caaeSpatrick    T operator()(const T& x, const T& y) const;
16946035553Spatrick};
17046035553Spatrick
17146035553Spatricktemplate <class T=void> // C++14
17276d0caaeSpatrickstruct bit_not {
17376d0caaeSpatrick    T operator()(const T& x) const;
17446035553Spatrick};
17546035553Spatrick
17676d0caaeSpatrickstruct identity; // C++20
17776d0caaeSpatrick
17846035553Spatricktemplate <class Predicate>
17976d0caaeSpatrickclass unary_negate // deprecated in C++17, removed in C++20
18046035553Spatrick    : public unary_function<typename Predicate::argument_type, bool>
18146035553Spatrick{
18246035553Spatrickpublic:
18346035553Spatrick    explicit unary_negate(const Predicate& pred);
18446035553Spatrick    bool operator()(const typename Predicate::argument_type& x) const;
18546035553Spatrick};
18646035553Spatrick
18776d0caaeSpatricktemplate <class Predicate> // deprecated in C++17, removed in C++20
18846035553Spatrickunary_negate<Predicate> not1(const Predicate& pred);
18946035553Spatrick
19046035553Spatricktemplate <class Predicate>
19176d0caaeSpatrickclass binary_negate // deprecated in C++17, removed in C++20
19246035553Spatrick    : public binary_function<typename Predicate::first_argument_type,
19346035553Spatrick                             typename Predicate::second_argument_type,
19446035553Spatrick                             bool>
19546035553Spatrick{
19646035553Spatrickpublic:
19746035553Spatrick    explicit binary_negate(const Predicate& pred);
19846035553Spatrick    bool operator()(const typename Predicate::first_argument_type& x,
19946035553Spatrick                    const typename Predicate::second_argument_type& y) const;
20046035553Spatrick};
20146035553Spatrick
20276d0caaeSpatricktemplate <class Predicate> // deprecated in C++17, removed in C++20
20346035553Spatrickbinary_negate<Predicate> not2(const Predicate& pred);
20446035553Spatrick
20576d0caaeSpatricktemplate <class F>
20676d0caaeSpatrickconstexpr unspecified not_fn(F&& f); // C++17, constexpr in C++20
20746035553Spatrick
20846035553Spatricktemplate<class T> struct is_bind_expression;
20946035553Spatricktemplate<class T> struct is_placeholder;
21046035553Spatrick
21146035553Spatrick    // See C++14 20.9.9, Function object binders
21246035553Spatricktemplate <class T> inline constexpr bool is_bind_expression_v
21346035553Spatrick  = is_bind_expression<T>::value; // C++17
21446035553Spatricktemplate <class T> inline constexpr int is_placeholder_v
21546035553Spatrick  = is_placeholder<T>::value; // C++17
21646035553Spatrick
21746035553Spatrick
21846035553Spatricktemplate<class Fn, class... BoundArgs>
21976d0caaeSpatrick  constexpr unspecified bind(Fn&&, BoundArgs&&...);  // constexpr in C++20
22046035553Spatricktemplate<class R, class Fn, class... BoundArgs>
22176d0caaeSpatrick  constexpr unspecified bind(Fn&&, BoundArgs&&...);  // constexpr in C++20
22246035553Spatrick
22346035553Spatricktemplate<class F, class... Args>
22476d0caaeSpatrick constexpr // constexpr in C++20
22546035553Spatrick invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17
22646035553Spatrick    noexcept(is_nothrow_invocable_v<F, Args...>);
22746035553Spatrick
22846035553Spatricknamespace placeholders {
22946035553Spatrick  // M is the implementation-defined number of placeholders
23046035553Spatrick  extern unspecified _1;
23146035553Spatrick  extern unspecified _2;
23246035553Spatrick  .
23346035553Spatrick  .
23446035553Spatrick  .
23546035553Spatrick  extern unspecified _Mp;
23646035553Spatrick}
23746035553Spatrick
23846035553Spatricktemplate <class Operation>
23946035553Spatrickclass binder1st     // deprecated in C++11, removed in C++17
24046035553Spatrick    : public unary_function<typename Operation::second_argument_type,
24146035553Spatrick                            typename Operation::result_type>
24246035553Spatrick{
24346035553Spatrickprotected:
24446035553Spatrick    Operation                               op;
24546035553Spatrick    typename Operation::first_argument_type value;
24646035553Spatrickpublic:
24746035553Spatrick    binder1st(const Operation& x, const typename Operation::first_argument_type y);
24846035553Spatrick    typename Operation::result_type operator()(      typename Operation::second_argument_type& x) const;
24946035553Spatrick    typename Operation::result_type operator()(const typename Operation::second_argument_type& x) const;
25046035553Spatrick};
25146035553Spatrick
25246035553Spatricktemplate <class Operation, class T>
25346035553Spatrickbinder1st<Operation> bind1st(const Operation& op, const T& x);  // deprecated in C++11, removed in C++17
25446035553Spatrick
25546035553Spatricktemplate <class Operation>
25646035553Spatrickclass binder2nd     // deprecated in C++11, removed in C++17
25746035553Spatrick    : public unary_function<typename Operation::first_argument_type,
25846035553Spatrick                            typename Operation::result_type>
25946035553Spatrick{
26046035553Spatrickprotected:
26146035553Spatrick    Operation                                op;
26246035553Spatrick    typename Operation::second_argument_type value;
26346035553Spatrickpublic:
26446035553Spatrick    binder2nd(const Operation& x, const typename Operation::second_argument_type y);
26546035553Spatrick    typename Operation::result_type operator()(      typename Operation::first_argument_type& x) const;
26646035553Spatrick    typename Operation::result_type operator()(const typename Operation::first_argument_type& x) const;
26746035553Spatrick};
26846035553Spatrick
26946035553Spatricktemplate <class Operation, class T>
27046035553Spatrickbinder2nd<Operation> bind2nd(const Operation& op, const T& x);  // deprecated in C++11, removed in C++17
27146035553Spatrick
27246035553Spatricktemplate <class Arg, class Result>      // deprecated in C++11, removed in C++17
27346035553Spatrickclass pointer_to_unary_function : public unary_function<Arg, Result>
27446035553Spatrick{
27546035553Spatrickpublic:
27646035553Spatrick    explicit pointer_to_unary_function(Result (*f)(Arg));
27746035553Spatrick    Result operator()(Arg x) const;
27846035553Spatrick};
27946035553Spatrick
28046035553Spatricktemplate <class Arg, class Result>
28146035553Spatrickpointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg));      // deprecated in C++11, removed in C++17
28246035553Spatrick
28346035553Spatricktemplate <class Arg1, class Arg2, class Result>      // deprecated in C++11, removed in C++17
28446035553Spatrickclass pointer_to_binary_function : public binary_function<Arg1, Arg2, Result>
28546035553Spatrick{
28646035553Spatrickpublic:
28746035553Spatrick    explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2));
28846035553Spatrick    Result operator()(Arg1 x, Arg2 y) const;
28946035553Spatrick};
29046035553Spatrick
29146035553Spatricktemplate <class Arg1, class Arg2, class Result>
29246035553Spatrickpointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2));      // deprecated in C++11, removed in C++17
29346035553Spatrick
29446035553Spatricktemplate<class S, class T>      // deprecated in C++11, removed in C++17
29546035553Spatrickclass mem_fun_t : public unary_function<T*, S>
29646035553Spatrick{
29746035553Spatrickpublic:
29846035553Spatrick    explicit mem_fun_t(S (T::*p)());
29946035553Spatrick    S operator()(T* p) const;
30046035553Spatrick};
30146035553Spatrick
30246035553Spatricktemplate<class S, class T, class A>
30346035553Spatrickclass mem_fun1_t : public binary_function<T*, A, S>      // deprecated in C++11, removed in C++17
30446035553Spatrick{
30546035553Spatrickpublic:
30646035553Spatrick    explicit mem_fun1_t(S (T::*p)(A));
30746035553Spatrick    S operator()(T* p, A x) const;
30846035553Spatrick};
30946035553Spatrick
31046035553Spatricktemplate<class S, class T>          mem_fun_t<S,T>    mem_fun(S (T::*f)());      // deprecated in C++11, removed in C++17
31146035553Spatricktemplate<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
31246035553Spatrick
31346035553Spatricktemplate<class S, class T>
31446035553Spatrickclass mem_fun_ref_t : public unary_function<T, S>      // deprecated in C++11, removed in C++17
31546035553Spatrick{
31646035553Spatrickpublic:
31746035553Spatrick    explicit mem_fun_ref_t(S (T::*p)());
31846035553Spatrick    S operator()(T& p) const;
31946035553Spatrick};
32046035553Spatrick
32146035553Spatricktemplate<class S, class T, class A>
32246035553Spatrickclass mem_fun1_ref_t : public binary_function<T, A, S>      // deprecated in C++11, removed in C++17
32346035553Spatrick{
32446035553Spatrickpublic:
32546035553Spatrick    explicit mem_fun1_ref_t(S (T::*p)(A));
32646035553Spatrick    S operator()(T& p, A x) const;
32746035553Spatrick};
32846035553Spatrick
32946035553Spatricktemplate<class S, class T>          mem_fun_ref_t<S,T>    mem_fun_ref(S (T::*f)());      // deprecated in C++11, removed in C++17
33046035553Spatricktemplate<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));     // deprecated in C++11, removed in C++17
33146035553Spatrick
33246035553Spatricktemplate <class S, class T>
33346035553Spatrickclass const_mem_fun_t : public unary_function<const T*, S>      // deprecated in C++11, removed in C++17
33446035553Spatrick{
33546035553Spatrickpublic:
33646035553Spatrick    explicit const_mem_fun_t(S (T::*p)() const);
33746035553Spatrick    S operator()(const T* p) const;
33846035553Spatrick};
33946035553Spatrick
34046035553Spatricktemplate <class S, class T, class A>
34146035553Spatrickclass const_mem_fun1_t : public binary_function<const T*, A, S>      // deprecated in C++11, removed in C++17
34246035553Spatrick{
34346035553Spatrickpublic:
34446035553Spatrick    explicit const_mem_fun1_t(S (T::*p)(A) const);
34546035553Spatrick    S operator()(const T* p, A x) const;
34646035553Spatrick};
34746035553Spatrick
34846035553Spatricktemplate <class S, class T>          const_mem_fun_t<S,T>    mem_fun(S (T::*f)() const);      // deprecated in C++11, removed in C++17
34946035553Spatricktemplate <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);     // deprecated in C++11, removed in C++17
35046035553Spatrick
35146035553Spatricktemplate <class S, class T>
35246035553Spatrickclass const_mem_fun_ref_t : public unary_function<T, S>      // deprecated in C++11, removed in C++17
35346035553Spatrick{
35446035553Spatrickpublic:
35546035553Spatrick    explicit const_mem_fun_ref_t(S (T::*p)() const);
35646035553Spatrick    S operator()(const T& p) const;
35746035553Spatrick};
35846035553Spatrick
35946035553Spatricktemplate <class S, class T, class A>
36046035553Spatrickclass const_mem_fun1_ref_t : public binary_function<T, A, S>      // deprecated in C++11, removed in C++17
36146035553Spatrick{
36246035553Spatrickpublic:
36346035553Spatrick    explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
36446035553Spatrick    S operator()(const T& p, A x) const;
36546035553Spatrick};
36646035553Spatrick
36746035553Spatricktemplate <class S, class T>          const_mem_fun_ref_t<S,T>    mem_fun_ref(S (T::*f)() const);   // deprecated in C++11, removed in C++17
36846035553Spatricktemplate <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);  // deprecated in C++11, removed in C++17
36946035553Spatrick
37076d0caaeSpatricktemplate<class R, class T>
37176d0caaeSpatrickconstexpr unspecified mem_fn(R T::*); // constexpr in C++20
37246035553Spatrick
37346035553Spatrickclass bad_function_call
37446035553Spatrick    : public exception
37546035553Spatrick{
37646035553Spatrick};
37746035553Spatrick
37846035553Spatricktemplate<class> class function; // undefined
37946035553Spatrick
38046035553Spatricktemplate<class R, class... ArgTypes>
38146035553Spatrickclass function<R(ArgTypes...)>
38246035553Spatrick  : public unary_function<T1, R>      // iff sizeof...(ArgTypes) == 1 and
38346035553Spatrick                                      // ArgTypes contains T1
38446035553Spatrick  : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
38546035553Spatrick                                      // ArgTypes contains T1 and T2
38646035553Spatrick{
38746035553Spatrickpublic:
38846035553Spatrick    typedef R result_type;
38946035553Spatrick
39046035553Spatrick    // construct/copy/destroy:
39146035553Spatrick    function() noexcept;
39246035553Spatrick    function(nullptr_t) noexcept;
39346035553Spatrick    function(const function&);
39446035553Spatrick    function(function&&) noexcept;
39546035553Spatrick    template<class F>
39646035553Spatrick      function(F);
39746035553Spatrick    template<Allocator Alloc>
39846035553Spatrick      function(allocator_arg_t, const Alloc&) noexcept;            // removed in C++17
39946035553Spatrick    template<Allocator Alloc>
40046035553Spatrick      function(allocator_arg_t, const Alloc&, nullptr_t) noexcept; // removed in C++17
40146035553Spatrick    template<Allocator Alloc>
40246035553Spatrick      function(allocator_arg_t, const Alloc&, const function&);    // removed in C++17
40346035553Spatrick    template<Allocator Alloc>
40446035553Spatrick      function(allocator_arg_t, const Alloc&, function&&);         // removed in C++17
40546035553Spatrick    template<class F, Allocator Alloc>
40646035553Spatrick      function(allocator_arg_t, const Alloc&, F);                  // removed in C++17
40746035553Spatrick
40846035553Spatrick    function& operator=(const function&);
40946035553Spatrick    function& operator=(function&&) noexcept;
41046035553Spatrick    function& operator=(nullptr_t) noexcept;
41146035553Spatrick    template<class F>
41246035553Spatrick      function& operator=(F&&);
41346035553Spatrick    template<class F>
41446035553Spatrick      function& operator=(reference_wrapper<F>) noexcept;
41546035553Spatrick
41646035553Spatrick    ~function();
41746035553Spatrick
41846035553Spatrick    // function modifiers:
41946035553Spatrick    void swap(function&) noexcept;
42046035553Spatrick    template<class F, class Alloc>
42146035553Spatrick      void assign(F&&, const Alloc&);                 // Removed in C++17
42246035553Spatrick
42346035553Spatrick    // function capacity:
42446035553Spatrick    explicit operator bool() const noexcept;
42546035553Spatrick
42646035553Spatrick    // function invocation:
42746035553Spatrick    R operator()(ArgTypes...) const;
42846035553Spatrick
42946035553Spatrick    // function target access:
43046035553Spatrick    const std::type_info& target_type() const noexcept;
43146035553Spatrick    template <typename T>       T* target() noexcept;
43246035553Spatrick    template <typename T> const T* target() const noexcept;
43346035553Spatrick};
43446035553Spatrick
43546035553Spatrick// Deduction guides
43646035553Spatricktemplate<class R, class ...Args>
43746035553Spatrickfunction(R(*)(Args...)) -> function<R(Args...)>; // since C++17
43846035553Spatrick
43946035553Spatricktemplate<class F>
44046035553Spatrickfunction(F) -> function<see-below>; // since C++17
44146035553Spatrick
44246035553Spatrick// Null pointer comparisons:
44346035553Spatricktemplate <class R, class ... ArgTypes>
44446035553Spatrick  bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
44546035553Spatrick
44646035553Spatricktemplate <class R, class ... ArgTypes>
44746035553Spatrick  bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
44846035553Spatrick
44946035553Spatricktemplate <class R, class ... ArgTypes>
45046035553Spatrick  bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
45146035553Spatrick
45246035553Spatricktemplate <class  R, class ... ArgTypes>
45346035553Spatrick  bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
45446035553Spatrick
45546035553Spatrick// specialized algorithms:
45646035553Spatricktemplate <class  R, class ... ArgTypes>
45746035553Spatrick  void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
45846035553Spatrick
45946035553Spatricktemplate <class T> struct hash;
46046035553Spatrick
46146035553Spatricktemplate <> struct hash<bool>;
46246035553Spatricktemplate <> struct hash<char>;
46346035553Spatricktemplate <> struct hash<signed char>;
46446035553Spatricktemplate <> struct hash<unsigned char>;
46576d0caaeSpatricktemplate <> struct hash<char8_t>; // since C++20
46646035553Spatricktemplate <> struct hash<char16_t>;
46746035553Spatricktemplate <> struct hash<char32_t>;
46846035553Spatricktemplate <> struct hash<wchar_t>;
46946035553Spatricktemplate <> struct hash<short>;
47046035553Spatricktemplate <> struct hash<unsigned short>;
47146035553Spatricktemplate <> struct hash<int>;
47246035553Spatricktemplate <> struct hash<unsigned int>;
47346035553Spatricktemplate <> struct hash<long>;
47446035553Spatricktemplate <> struct hash<long long>;
47546035553Spatricktemplate <> struct hash<unsigned long>;
47646035553Spatricktemplate <> struct hash<unsigned long long>;
47746035553Spatrick
47846035553Spatricktemplate <> struct hash<float>;
47946035553Spatricktemplate <> struct hash<double>;
48046035553Spatricktemplate <> struct hash<long double>;
48146035553Spatrick
48246035553Spatricktemplate<class T> struct hash<T*>;
48346035553Spatricktemplate <> struct hash<nullptr_t>;  // C++17
48446035553Spatrick
485*4bdff4beSrobertnamespace ranges {
486*4bdff4beSrobert  // [range.cmp], concept-constrained comparisons
487*4bdff4beSrobert  struct equal_to;
488*4bdff4beSrobert  struct not_equal_to;
489*4bdff4beSrobert  struct greater;
490*4bdff4beSrobert  struct less;
491*4bdff4beSrobert  struct greater_equal;
492*4bdff4beSrobert  struct less_equal;
493*4bdff4beSrobert}
494*4bdff4beSrobert
49546035553Spatrick}  // std
49646035553Spatrick
49746035553SpatrickPOLICY:  For non-variadic implementations, the number of arguments is limited
49846035553Spatrick         to 3.  It is hoped that the need for non-variadic implementations
49946035553Spatrick         will be minimal.
50046035553Spatrick
50146035553Spatrick*/
50246035553Spatrick
50376d0caaeSpatrick#include <__algorithm/search.h>
504*4bdff4beSrobert#include <__assert> // all public C++ headers provide the assertion handler
505*4bdff4beSrobert#include <__compare/compare_three_way.h>
50646035553Spatrick#include <__config>
50776d0caaeSpatrick#include <__debug>
50876d0caaeSpatrick#include <__functional/binary_function.h> // TODO: deprecate
50976d0caaeSpatrick#include <__functional/binary_negate.h>
51076d0caaeSpatrick#include <__functional/bind.h>
511*4bdff4beSrobert#include <__functional/bind_back.h>
512*4bdff4beSrobert#include <__functional/bind_front.h>
51376d0caaeSpatrick#include <__functional/binder1st.h>
51476d0caaeSpatrick#include <__functional/binder2nd.h>
515*4bdff4beSrobert#include <__functional/boyer_moore_searcher.h>
516*4bdff4beSrobert#include <__functional/compose.h>
51776d0caaeSpatrick#include <__functional/default_searcher.h>
51876d0caaeSpatrick#include <__functional/function.h>
51976d0caaeSpatrick#include <__functional/hash.h>
52076d0caaeSpatrick#include <__functional/identity.h>
52176d0caaeSpatrick#include <__functional/invoke.h>
52276d0caaeSpatrick#include <__functional/mem_fn.h> // TODO: deprecate
52376d0caaeSpatrick#include <__functional/mem_fun_ref.h>
52476d0caaeSpatrick#include <__functional/not_fn.h>
52576d0caaeSpatrick#include <__functional/operations.h>
52676d0caaeSpatrick#include <__functional/pointer_to_binary_function.h>
52776d0caaeSpatrick#include <__functional/pointer_to_unary_function.h>
52876d0caaeSpatrick#include <__functional/ranges_operations.h>
52976d0caaeSpatrick#include <__functional/reference_wrapper.h>
53076d0caaeSpatrick#include <__functional/unary_function.h> // TODO: deprecate
53176d0caaeSpatrick#include <__functional/unary_negate.h>
53276d0caaeSpatrick#include <__functional/unwrap_ref.h>
53376d0caaeSpatrick#include <__utility/forward.h>
53446035553Spatrick#include <exception>
535*4bdff4beSrobert#include <memory> // TODO: find out why removing this breaks the modules build
53676d0caaeSpatrick#include <type_traits>
53776d0caaeSpatrick#include <typeinfo>
53846035553Spatrick#include <version>
53946035553Spatrick
54046035553Spatrick#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
54146035553Spatrick#  pragma GCC system_header
54246035553Spatrick#endif
54346035553Spatrick
544*4bdff4beSrobert#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
545*4bdff4beSrobert#  include <concepts>
546*4bdff4beSrobert#  include <tuple>
547*4bdff4beSrobert#  include <utility>
548*4bdff4beSrobert#endif
549*4bdff4beSrobert
55046035553Spatrick#endif // _LIBCPP_FUNCTIONAL
551