[libcxx-commits] [libcxx] [libc++] Optimize lexicographical_compare (PR #65279)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 25 09:32:49 PDT 2024


================
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 // Tags to represent the canonical operations
 struct __equal_tag {};
 struct __plus_tag {};
-struct __less_tag {};
+struct __totally_ordered_less_tag {};
----------------
ldionne wrote:

This needs a comment explaining what it represents, and in particular how it differs from what would be `__less_tag`.

I also think we need to document the nature of these tags better. Maybe something like

```
// Tags to represent canonical operations
//
// Not all of these canonical operations are exclusively syntactic. For example, we use the
// `__totally_ordered_less_tag` to encode not only that the operation is equivalent to a
// syntactic application of `<`, but also that the operation forms a total order that is consistent
// with `operator==`, which is provided by e.g. ranges::less.
```

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


More information about the libcxx-commits mailing list