functional.h 870 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_RANGES_FUNCTIONAL_H_
  5. #define BASE_RANGES_FUNCTIONAL_H_
  6. #include <functional>
  7. #include <type_traits>
  8. #include <utility>
  9. namespace base {
  10. namespace ranges {
  11. // Simplified implementations of C++20's std::ranges comparison function
  12. // objects. As opposed to the std::ranges implementation, these versions do not
  13. // constrain the passed-in types.
  14. //
  15. // Reference: https://wg21.link/range.cmp
  16. using equal_to = std::equal_to<>;
  17. using not_equal_to = std::not_equal_to<>;
  18. using greater = std::greater<>;
  19. using less = std::less<>;
  20. using greater_equal = std::greater_equal<>;
  21. using less_equal = std::less_equal<>;
  22. } // namespace ranges
  23. } // namespace base
  24. #endif // BASE_RANGES_FUNCTIONAL_H_