| 1 | // -*- C++ -*- |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // 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 |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_FUNCTIONAL |
| 11 | #define _LIBCPP_FUNCTIONAL |
| 12 | |
| 13 | /* |
| 14 | functional synopsis |
| 15 | |
| 16 | namespace std |
| 17 | { |
| 18 | |
| 19 | template <class Arg, class Result> |
| 20 | struct unary_function |
| 21 | { |
| 22 | typedef Arg argument_type; |
| 23 | typedef Result result_type; |
| 24 | }; |
| 25 | |
| 26 | template <class Arg1, class Arg2, class Result> |
| 27 | struct binary_function |
| 28 | { |
| 29 | typedef Arg1 first_argument_type; |
| 30 | typedef Arg2 second_argument_type; |
| 31 | typedef Result result_type; |
| 32 | }; |
| 33 | |
| 34 | template <class T> |
| 35 | class reference_wrapper |
| 36 | : public unary_function<T1, R> // if wrapping a unary functor |
| 37 | : public binary_function<T1, T2, R> // if wrapping a binary functor |
| 38 | { |
| 39 | public: |
| 40 | // types |
| 41 | typedef T type; |
| 42 | typedef see below result_type; // Not always defined |
| 43 | |
| 44 | // construct/copy/destroy |
| 45 | template<class U> |
| 46 | constexpr reference_wrapper(U&&); // constexpr since C++20 |
| 47 | constexpr reference_wrapper(const reference_wrapper<T>& x) noexcept; // constexpr since C++20 |
| 48 | |
| 49 | // assignment |
| 50 | constexpr reference_wrapper& |
| 51 | operator=(const reference_wrapper<T>& x) noexcept; // constexpr since C++20 |
| 52 | |
| 53 | // access |
| 54 | constexpr operator T& () const noexcept; // constexpr since C++20 |
| 55 | constexpr T& get() const noexcept; // constexpr since C++20 |
| 56 | |
| 57 | // invoke |
| 58 | template <class... ArgTypes> |
| 59 | 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 |
| 62 | }; |
| 63 | |
| 64 | template <class T> |
| 65 | reference_wrapper(T&) -> reference_wrapper<T>; |
| 66 | |
| 67 | template <class T> reference_wrapper<T> ref(T& t) noexcept; |
| 68 | template <class T> void ref(const T&& t) = delete; |
| 69 | template <class T> reference_wrapper<T> ref(reference_wrapper<T>t) noexcept; |
| 70 | |
| 71 | template <class T> reference_wrapper<const T> cref(const T& t) noexcept; |
| 72 | template <class T> void cref(const T&& t) = delete; |
| 73 | template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept; |
| 74 | |
| 75 | template <class T> struct unwrap_reference; // since C++20 |
| 76 | template <class T> struct unwrap_ref_decay : unwrap_reference<decay_t<T>> { }; // since C++20 |
| 77 | template <class T> using unwrap_reference_t = typename unwrap_reference<T>::type; // since C++20 |
| 78 | template <class T> using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type; // since C++20 |
| 79 | |
| 80 | // [refwrap.comparisons], comparisons |
| 81 | friend constexpr bool operator==(reference_wrapper, reference_wrapper); // Since C++26 |
| 82 | friend constexpr bool operator==(reference_wrapper, const T&); // Since C++26 |
| 83 | friend constexpr bool operator==(reference_wrapper, reference_wrapper<const T>); // Since C++26 |
| 84 | |
| 85 | friend constexpr auto operator<=>(reference_wrapper, reference_wrapper); // Since C++26 |
| 86 | friend constexpr auto operator<=>(reference_wrapper, const T&); // Since C++26 |
| 87 | friend constexpr auto operator<=>(reference_wrapper, reference_wrapper<const T>); // Since C++26 |
| 88 | |
| 89 | template <class T> // <class T=void> in C++14 |
| 90 | struct plus { |
| 91 | T operator()(const T& x, const T& y) const; |
| 92 | }; |
| 93 | |
| 94 | template <class T> // <class T=void> in C++14 |
| 95 | struct minus { |
| 96 | T operator()(const T& x, const T& y) const; |
| 97 | }; |
| 98 | |
| 99 | template <class T> // <class T=void> in C++14 |
| 100 | struct multiplies { |
| 101 | T operator()(const T& x, const T& y) const; |
| 102 | }; |
| 103 | |
| 104 | template <class T> // <class T=void> in C++14 |
| 105 | struct divides { |
| 106 | T operator()(const T& x, const T& y) const; |
| 107 | }; |
| 108 | |
| 109 | template <class T> // <class T=void> in C++14 |
| 110 | struct modulus { |
| 111 | T operator()(const T& x, const T& y) const; |
| 112 | }; |
| 113 | |
| 114 | template <class T> // <class T=void> in C++14 |
| 115 | struct negate { |
| 116 | T operator()(const T& x) const; |
| 117 | }; |
| 118 | |
| 119 | template <class T> // <class T=void> in C++14 |
| 120 | struct equal_to { |
| 121 | bool operator()(const T& x, const T& y) const; |
| 122 | }; |
| 123 | |
| 124 | template <class T> // <class T=void> in C++14 |
| 125 | struct not_equal_to { |
| 126 | bool operator()(const T& x, const T& y) const; |
| 127 | }; |
| 128 | |
| 129 | template <class T> // <class T=void> in C++14 |
| 130 | struct greater { |
| 131 | bool operator()(const T& x, const T& y) const; |
| 132 | }; |
| 133 | |
| 134 | template <class T> // <class T=void> in C++14 |
| 135 | struct less { |
| 136 | bool operator()(const T& x, const T& y) const; |
| 137 | }; |
| 138 | |
| 139 | template <class T> // <class T=void> in C++14 |
| 140 | struct greater_equal { |
| 141 | bool operator()(const T& x, const T& y) const; |
| 142 | }; |
| 143 | |
| 144 | template <class T> // <class T=void> in C++14 |
| 145 | struct less_equal { |
| 146 | bool operator()(const T& x, const T& y) const; |
| 147 | }; |
| 148 | |
| 149 | // [comparisons.three.way], class compare_three_way |
| 150 | struct compare_three_way; |
| 151 | |
| 152 | template <class T> // <class T=void> in C++14 |
| 153 | struct logical_and { |
| 154 | bool operator()(const T& x, const T& y) const; |
| 155 | }; |
| 156 | |
| 157 | template <class T> // <class T=void> in C++14 |
| 158 | struct logical_or { |
| 159 | bool operator()(const T& x, const T& y) const; |
| 160 | }; |
| 161 | |
| 162 | template <class T> // <class T=void> in C++14 |
| 163 | struct logical_not { |
| 164 | bool operator()(const T& x) const; |
| 165 | }; |
| 166 | |
| 167 | template <class T> // <class T=void> in C++14 |
| 168 | struct bit_and { |
| 169 | T operator()(const T& x, const T& y) const; |
| 170 | }; |
| 171 | |
| 172 | template <class T> // <class T=void> in C++14 |
| 173 | struct bit_or { |
| 174 | T operator()(const T& x, const T& y) const; |
| 175 | }; |
| 176 | |
| 177 | template <class T> // <class T=void> in C++14 |
| 178 | struct bit_xor { |
| 179 | T operator()(const T& x, const T& y) const; |
| 180 | }; |
| 181 | |
| 182 | template <class T=void> // C++14 |
| 183 | struct bit_not { |
| 184 | T operator()(const T& x) const; |
| 185 | }; |
| 186 | |
| 187 | struct identity; // C++20 |
| 188 | |
| 189 | template <class Predicate> |
| 190 | class unary_negate // deprecated in C++17, removed in C++20 |
| 191 | : public unary_function<typename Predicate::argument_type, bool> |
| 192 | { |
| 193 | public: |
| 194 | explicit unary_negate(const Predicate& pred); |
| 195 | bool operator()(const typename Predicate::argument_type& x) const; |
| 196 | }; |
| 197 | |
| 198 | template <class Predicate> // deprecated in C++17, removed in C++20 |
| 199 | unary_negate<Predicate> not1(const Predicate& pred); |
| 200 | |
| 201 | template <class Predicate> |
| 202 | class binary_negate // deprecated in C++17, removed in C++20 |
| 203 | : public binary_function<typename Predicate::first_argument_type, |
| 204 | typename Predicate::second_argument_type, |
| 205 | bool> |
| 206 | { |
| 207 | public: |
| 208 | explicit binary_negate(const Predicate& pred); |
| 209 | bool operator()(const typename Predicate::first_argument_type& x, |
| 210 | const typename Predicate::second_argument_type& y) const; |
| 211 | }; |
| 212 | |
| 213 | template <class Predicate> // deprecated in C++17, removed in C++20 |
| 214 | binary_negate<Predicate> not2(const Predicate& pred); |
| 215 | |
| 216 | template <class F> |
| 217 | constexpr unspecified not_fn(F&& f); // C++17, constexpr in C++20 |
| 218 | template <auto f> |
| 219 | constexpr unspecified not_fn() noexcept; // C++26 |
| 220 | |
| 221 | // [func.bind.partial], function templates bind_front and bind_back |
| 222 | template<class F, class... Args> |
| 223 | constexpr unspecified bind_front(F&&, Args&&...); // C++20 |
| 224 | template<class F, class... Args> |
| 225 | constexpr unspecified bind_back(F&&, Args&&...); // C++23 |
| 226 | |
| 227 | template<class T> struct is_bind_expression; |
| 228 | template<class T> struct is_placeholder; |
| 229 | |
| 230 | // See C++14 20.9.9, Function object binders |
| 231 | template <class T> inline constexpr bool is_bind_expression_v |
| 232 | = is_bind_expression<T>::value; // C++17 |
| 233 | template <class T> inline constexpr int is_placeholder_v |
| 234 | = is_placeholder<T>::value; // C++17 |
| 235 | |
| 236 | |
| 237 | template<class Fn, class... BoundArgs> |
| 238 | constexpr unspecified bind(Fn&&, BoundArgs&&...); // constexpr in C++20 |
| 239 | template<class R, class Fn, class... BoundArgs> |
| 240 | constexpr unspecified bind(Fn&&, BoundArgs&&...); // constexpr in C++20 |
| 241 | |
| 242 | // [func.invoke] |
| 243 | template<class F, class... Args> |
| 244 | constexpr // constexpr in C++20 |
| 245 | invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17 |
| 246 | noexcept(is_nothrow_invocable_v<F, Args...>); |
| 247 | |
| 248 | template<class R, class F, class... Args> |
| 249 | constexpr R invoke_r(F&& f, Args&&... args) // C++23 |
| 250 | noexcept(is_nothrow_invocable_r_v<R, F, Args...>); |
| 251 | |
| 252 | namespace placeholders { |
| 253 | // M is the implementation-defined number of placeholders |
| 254 | extern unspecified _1; |
| 255 | extern unspecified _2; |
| 256 | . |
| 257 | . |
| 258 | . |
| 259 | extern unspecified _Mp; |
| 260 | } |
| 261 | |
| 262 | template <class Operation> |
| 263 | class binder1st // deprecated in C++11, removed in C++17 |
| 264 | : public unary_function<typename Operation::second_argument_type, |
| 265 | typename Operation::result_type> |
| 266 | { |
| 267 | protected: |
| 268 | Operation op; |
| 269 | typename Operation::first_argument_type value; |
| 270 | public: |
| 271 | binder1st(const Operation& x, const typename Operation::first_argument_type y); |
| 272 | typename Operation::result_type operator()( typename Operation::second_argument_type& x) const; |
| 273 | typename Operation::result_type operator()(const typename Operation::second_argument_type& x) const; |
| 274 | }; |
| 275 | |
| 276 | template <class Operation, class T> |
| 277 | binder1st<Operation> bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 |
| 278 | |
| 279 | template <class Operation> |
| 280 | class binder2nd // deprecated in C++11, removed in C++17 |
| 281 | : public unary_function<typename Operation::first_argument_type, |
| 282 | typename Operation::result_type> |
| 283 | { |
| 284 | protected: |
| 285 | Operation op; |
| 286 | typename Operation::second_argument_type value; |
| 287 | public: |
| 288 | binder2nd(const Operation& x, const typename Operation::second_argument_type y); |
| 289 | typename Operation::result_type operator()( typename Operation::first_argument_type& x) const; |
| 290 | typename Operation::result_type operator()(const typename Operation::first_argument_type& x) const; |
| 291 | }; |
| 292 | |
| 293 | template <class Operation, class T> |
| 294 | binder2nd<Operation> bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 |
| 295 | |
| 296 | template <class Arg, class Result> // deprecated in C++11, removed in C++17 |
| 297 | class pointer_to_unary_function : public unary_function<Arg, Result> |
| 298 | { |
| 299 | public: |
| 300 | explicit pointer_to_unary_function(Result (*f)(Arg)); |
| 301 | Result operator()(Arg x) const; |
| 302 | }; |
| 303 | |
| 304 | template <class Arg, class Result> |
| 305 | pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17 |
| 306 | |
| 307 | template <class Arg1, class Arg2, class Result> // deprecated in C++11, removed in C++17 |
| 308 | class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result> |
| 309 | { |
| 310 | public: |
| 311 | explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)); |
| 312 | Result operator()(Arg1 x, Arg2 y) const; |
| 313 | }; |
| 314 | |
| 315 | template <class Arg1, class Arg2, class Result> |
| 316 | pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17 |
| 317 | |
| 318 | template<class S, class T> // deprecated in C++11, removed in C++17 |
| 319 | class mem_fun_t : public unary_function<T*, S> |
| 320 | { |
| 321 | public: |
| 322 | explicit mem_fun_t(S (T::*p)()); |
| 323 | S operator()(T* p) const; |
| 324 | }; |
| 325 | |
| 326 | template<class S, class T, class A> |
| 327 | class mem_fun1_t : public binary_function<T*, A, S> // deprecated in C++11, removed in C++17 |
| 328 | { |
| 329 | public: |
| 330 | explicit mem_fun1_t(S (T::*p)(A)); |
| 331 | S operator()(T* p, A x) const; |
| 332 | }; |
| 333 | |
| 334 | template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17 |
| 335 | template<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 |
| 336 | |
| 337 | template<class S, class T> |
| 338 | class mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17 |
| 339 | { |
| 340 | public: |
| 341 | explicit mem_fun_ref_t(S (T::*p)()); |
| 342 | S operator()(T& p) const; |
| 343 | }; |
| 344 | |
| 345 | template<class S, class T, class A> |
| 346 | class mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17 |
| 347 | { |
| 348 | public: |
| 349 | explicit mem_fun1_ref_t(S (T::*p)(A)); |
| 350 | S operator()(T& p, A x) const; |
| 351 | }; |
| 352 | |
| 353 | template<class S, class T> |
| 354 | mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17 |
| 355 | template<class S, class T, class A> |
| 356 | mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17 |
| 357 | |
| 358 | template <class S, class T> |
| 359 | class const_mem_fun_t : public unary_function<const T*, S> // deprecated in C++11, removed in C++17 |
| 360 | { |
| 361 | public: |
| 362 | explicit const_mem_fun_t(S (T::*p)() const); |
| 363 | S operator()(const T* p) const; |
| 364 | }; |
| 365 | |
| 366 | template <class S, class T, class A> |
| 367 | class const_mem_fun1_t : public binary_function<const T*, A, S> // deprecated in C++11, removed in C++17 |
| 368 | { |
| 369 | public: |
| 370 | explicit const_mem_fun1_t(S (T::*p)(A) const); |
| 371 | S operator()(const T* p, A x) const; |
| 372 | }; |
| 373 | |
| 374 | template <class S, class T> |
| 375 | const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17 |
| 376 | template <class S, class T, class A> |
| 377 | const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 |
| 378 | |
| 379 | template <class S, class T> |
| 380 | class const_mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17 |
| 381 | { |
| 382 | public: |
| 383 | explicit const_mem_fun_ref_t(S (T::*p)() const); |
| 384 | S operator()(const T& p) const; |
| 385 | }; |
| 386 | |
| 387 | template <class S, class T, class A> |
| 388 | class const_mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17 |
| 389 | { |
| 390 | public: |
| 391 | explicit const_mem_fun1_ref_t(S (T::*p)(A) const); |
| 392 | S operator()(const T& p, A x) const; |
| 393 | }; |
| 394 | |
| 395 | template <class S, class T> |
| 396 | const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17 |
| 397 | template <class S, class T, class A> |
| 398 | const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 |
| 399 | |
| 400 | template<class R, class T> constexpr unspecified mem_fn(R T::*) noexcept; // constexpr in C++20 |
| 401 | |
| 402 | class bad_function_call |
| 403 | : public exception |
| 404 | { |
| 405 | }; |
| 406 | |
| 407 | template<class> class function; // undefined |
| 408 | |
| 409 | template<class R, class... ArgTypes> |
| 410 | class function<R(ArgTypes...)> |
| 411 | : public unary_function<T1, R> // iff sizeof...(ArgTypes) == 1 and |
| 412 | // ArgTypes contains T1 |
| 413 | : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and |
| 414 | // ArgTypes contains T1 and T2 |
| 415 | { |
| 416 | public: |
| 417 | typedef R result_type; |
| 418 | |
| 419 | // construct/copy/destroy: |
| 420 | function() noexcept; |
| 421 | function(nullptr_t) noexcept; |
| 422 | function(const function&); |
| 423 | function(function&&) noexcept; |
| 424 | template<class F> |
| 425 | function(F); |
| 426 | template<Allocator Alloc> |
| 427 | function(allocator_arg_t, const Alloc&) noexcept; // removed in C++17 |
| 428 | template<Allocator Alloc> |
| 429 | function(allocator_arg_t, const Alloc&, nullptr_t) noexcept; // removed in C++17 |
| 430 | template<Allocator Alloc> |
| 431 | function(allocator_arg_t, const Alloc&, const function&); // removed in C++17 |
| 432 | template<Allocator Alloc> |
| 433 | function(allocator_arg_t, const Alloc&, function&&); // removed in C++17 |
| 434 | template<class F, Allocator Alloc> |
| 435 | function(allocator_arg_t, const Alloc&, F); // removed in C++17 |
| 436 | |
| 437 | function& operator=(const function&); |
| 438 | function& operator=(function&&) noexcept; |
| 439 | function& operator=(nullptr_t) noexcept; |
| 440 | template<class F> |
| 441 | function& operator=(F&&); |
| 442 | template<class F> |
| 443 | function& operator=(reference_wrapper<F>) noexcept; |
| 444 | |
| 445 | ~function(); |
| 446 | |
| 447 | // function modifiers: |
| 448 | void swap(function&) noexcept; |
| 449 | template<class F, class Alloc> |
| 450 | void assign(F&&, const Alloc&); // Removed in C++17 |
| 451 | |
| 452 | // function capacity: |
| 453 | explicit operator bool() const noexcept; |
| 454 | |
| 455 | // function invocation: |
| 456 | R operator()(ArgTypes...) const; |
| 457 | |
| 458 | // function target access: |
| 459 | const std::type_info& target_type() const noexcept; |
| 460 | template <typename T> T* target() noexcept; |
| 461 | template <typename T> const T* target() const noexcept; |
| 462 | }; |
| 463 | |
| 464 | // Deduction guides |
| 465 | template<class R, class ...Args> |
| 466 | function(R(*)(Args...)) -> function<R(Args...)>; // since C++17 |
| 467 | |
| 468 | template<class F> |
| 469 | function(F) -> function<see-below>; // since C++17 |
| 470 | |
| 471 | // Null pointer comparisons: |
| 472 | template <class R, class ... ArgTypes> |
| 473 | bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept; |
| 474 | |
| 475 | template <class R, class ... ArgTypes> |
| 476 | bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept; // removed in C++20 |
| 477 | |
| 478 | template <class R, class ... ArgTypes> |
| 479 | bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept; // removed in C++20 |
| 480 | |
| 481 | template <class R, class ... ArgTypes> |
| 482 | bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept; // removed in C++20 |
| 483 | |
| 484 | // specialized algorithms: |
| 485 | template <class R, class ... ArgTypes> |
| 486 | void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept; |
| 487 | |
| 488 | template <class T> struct hash; |
| 489 | |
| 490 | template <> struct hash<bool>; |
| 491 | template <> struct hash<char>; |
| 492 | template <> struct hash<signed char>; |
| 493 | template <> struct hash<unsigned char>; |
| 494 | template <> struct hash<char8_t>; // since C++20 |
| 495 | template <> struct hash<char16_t>; |
| 496 | template <> struct hash<char32_t>; |
| 497 | template <> struct hash<wchar_t>; |
| 498 | template <> struct hash<short>; |
| 499 | template <> struct hash<unsigned short>; |
| 500 | template <> struct hash<int>; |
| 501 | template <> struct hash<unsigned int>; |
| 502 | template <> struct hash<long>; |
| 503 | template <> struct hash<long long>; |
| 504 | template <> struct hash<unsigned long>; |
| 505 | template <> struct hash<unsigned long long>; |
| 506 | |
| 507 | template <> struct hash<float>; |
| 508 | template <> struct hash<double>; |
| 509 | template <> struct hash<long double>; |
| 510 | |
| 511 | template<class T> struct hash<T*>; |
| 512 | template <> struct hash<nullptr_t>; // C++17 |
| 513 | |
| 514 | namespace ranges { |
| 515 | // [range.cmp], concept-constrained comparisons |
| 516 | struct equal_to; |
| 517 | struct not_equal_to; |
| 518 | struct greater; |
| 519 | struct less; |
| 520 | struct greater_equal; |
| 521 | struct less_equal; |
| 522 | } |
| 523 | |
| 524 | } // std |
| 525 | |
| 526 | POLICY: For non-variadic implementations, the number of arguments is limited |
| 527 | to 3. It is hoped that the need for non-variadic implementations |
| 528 | will be minimal. |
| 529 | |
| 530 | */ |
| 531 | |
| 532 | #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 533 | # include <__cxx03/functional> |
| 534 | #else |
| 535 | # include <__config> |
| 536 | |
| 537 | # include <__functional/binary_function.h> |
| 538 | # include <__functional/binary_negate.h> |
| 539 | # include <__functional/bind.h> |
| 540 | # include <__functional/binder1st.h> |
| 541 | # include <__functional/binder2nd.h> |
| 542 | # include <__functional/hash.h> |
| 543 | # include <__functional/mem_fn.h> // TODO: deprecate |
| 544 | # include <__functional/mem_fun_ref.h> |
| 545 | # include <__functional/operations.h> |
| 546 | # include <__functional/pointer_to_binary_function.h> |
| 547 | # include <__functional/pointer_to_unary_function.h> |
| 548 | # include <__functional/reference_wrapper.h> |
| 549 | # include <__functional/unary_function.h> |
| 550 | # include <__functional/unary_negate.h> |
| 551 | |
| 552 | # ifndef _LIBCPP_CXX03_LANG |
| 553 | # include <__functional/function.h> |
| 554 | # endif |
| 555 | |
| 556 | # if _LIBCPP_STD_VER >= 17 |
| 557 | # include <__functional/boyer_moore_searcher.h> |
| 558 | # include <__functional/default_searcher.h> |
| 559 | # include <__functional/invoke.h> |
| 560 | # include <__functional/not_fn.h> |
| 561 | # endif |
| 562 | |
| 563 | # if _LIBCPP_STD_VER >= 20 |
| 564 | # include <__functional/bind_back.h> |
| 565 | # include <__functional/bind_front.h> |
| 566 | # include <__functional/identity.h> |
| 567 | # include <__functional/ranges_operations.h> |
| 568 | # include <__type_traits/unwrap_ref.h> |
| 569 | # endif |
| 570 | |
| 571 | # include <version> |
| 572 | |
| 573 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 574 | # pragma GCC system_header |
| 575 | # endif |
| 576 | |
| 577 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && defined(_LIBCPP_CXX03_LANG) |
| 578 | # include <limits> |
| 579 | # include <new> |
| 580 | # endif |
| 581 | |
| 582 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 |
| 583 | # include <array> |
| 584 | # include <initializer_list> |
| 585 | # include <unordered_map> |
| 586 | # endif |
| 587 | |
| 588 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 |
| 589 | # include <atomic> |
| 590 | # include <concepts> |
| 591 | # include <cstdlib> |
| 592 | # include <exception> |
| 593 | # include <iosfwd> |
| 594 | # include <memory> |
| 595 | # include <stdexcept> |
| 596 | # include <tuple> |
| 597 | # include <type_traits> |
| 598 | # include <typeinfo> |
| 599 | # include <utility> |
| 600 | # include <vector> |
| 601 | # endif |
| 602 | |
| 603 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 23 |
| 604 | # include <__vector/vector.h> |
| 605 | # endif |
| 606 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 607 | |
| 608 | #endif // _LIBCPP_FUNCTIONAL |
| 609 | |