[libcxx-commits] [libcxx] [libc++][ranges] optimize the performance of `ranges::starts_with` (PR #84570)

Xiaoyang Liu via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 18 07:54:39 PDT 2024


================
@@ -42,22 +46,44 @@ struct __fn {
             class _Proj1 = identity,
             class _Proj2 = identity>
     requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
-  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr bool operator()(
----------------
xiaoyang-sde wrote:

Great! I'm willing to submit a patch. Would you mind elaborating on how this can be implemented? It seems that MSVC STL use a pair of macros (_STATIC_CALL_OPERATOR and _CONST_CALL_OPERATOR) to convert most stateless function objects' operator() to static: https://github.com/microsoft/STL/pull/4358


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


More information about the libcxx-commits mailing list