[libcxx-commits] [libcxx] [libc++] Optimize most of the __tree search algorithms (PR #155245)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 2 10:52:16 PDT 2025


================
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___UTILITY_THREE_WAY_COMPARATOR_H
+#define _LIBCPP___UTILITY_THREE_WAY_COMPARATOR_H
+
+#include <__config>
+#include <__type_traits/desugars_to.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_arithmetic.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+// This file adds a __lazy_synth_three_way_comparator, which tries to build an efficient three way comparison from a
+// binary comparator. That is done in multiple steps:
+// 1) Check whether the comparator desugars to a less than operator
----------------
ldionne wrote:

```suggestion
// 1) Check whether the comparator desugars to a less-than operator
```

https://github.com/llvm/llvm-project/pull/155245


More information about the libcxx-commits mailing list