From aca55f993f472cd73d69a6d8ba1c5cf6808470cd Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Sat, 10 May 2025 15:00:47 +0000 Subject: [PATCH] feat(kernel/std): :sparkles: implement std::less specializations for pointer types and void --- Kernel/include_std/functional | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Kernel/include_std/functional b/Kernel/include_std/functional index faa80615..ed998a0d 100644 --- a/Kernel/include_std/functional +++ b/Kernel/include_std/functional @@ -260,6 +260,28 @@ namespace std } }; + template + struct less + { + constexpr bool operator()(const T *lhs, const T *rhs) const + { + if (__builtin_is_constant_evaluated()) + return lhs < rhs; + return (uintptr_t)lhs < (uintptr_t)rhs; + } + }; + + template <> + class less + { + public: + template + constexpr auto operator()(T &&lhs, U &&rhs) const -> decltype(std::forward(lhs) < std::forward(rhs)) + { + return std::forward(lhs) < std::forward(rhs); + } + }; + template constexpr typename std::result_of::type bind(F &&f, Args &&...args);