[libcxx-commits] [libcxx] [libc++] Apply the predicate exactly N times in stable_partition (PR #203949)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 24 16:07:03 PDT 2026
sjhowe888 wrote:
How do I respond on GitHub?
> can you comment on what motivated the filing of this issue?
yes. I tested Microsoft, GCC & CLANG both buffered and unbuffered. 5 out of
6 cases worked in that the predicate was called the correct number of times.
The 6th case was this one.
> It seems to have almost been an agentic investigation
No. No AI used at all. But I autistic. Does that count
I am aiming to beat Microsoft, GCC & CLANG at
sort()
stable_sort()
inplace_merge()
stable_partition()
partial_sort()
nth_element()
In some cases I have brand new algorithms to try out
In other cases I have observed that the ISO C++ standard requirements could
be tightened.
I some cases the wording in the standard seems wrong
Note: in ISO C++ 26, the complexity requirements were tightened for
inplace_merge(). That was me.
I don't agree with you on stable_partition, the number of times the
predicate is called.
But I do agree with you on inplace_merge().
Stephen Howe
On Thu, 18 Jun 2026 at 20:42, Louis Dionne ***@***.***> wrote:
> ***@***.**** commented on this pull request.
>
> I'll say that I really dislike that the standard forces us into a specific
> number of predicate evaluations. That's been discussed a few times in WG21
> because this usually ends up just causing problems and inefficiencies.
> There are algorithms where calling the predicate more times can be more
> efficient, if we save on e.g. expensive iterator traversal.
>
> Also, the tests here are really complex. I haven't looked deeply into
> them, but is there no way to simplify them?
>
> @sjhowe888 <https://github.com/sjhowe888> as the originator of #203643
> <https://github.com/llvm/llvm-project/issues/203643>, can you comment on
> what motivated the filing of this issue? Is this a real use case? It seems
> to have almost been an agentic investigation.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/llvm/llvm-project/pull/203949?email_source=notifications&email_token=A2NO5CHCWVTNBCQ22WLZUQT5ARA2NA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJSHAYDINZZGE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-4528047914>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/A2NO5CF3NPKKNUL6UYMVPTL5ARA2NAVCNFSNUABEKJSXA33TNF2G64TZHM3TKOBSGE2DGMR3JFZXG5LFHM2DMNRXGI2TENBWG2QXMAQ>
> .
> Triage notifications, keep track of coding agent tasks and review pull
> requests on the go with GitHub Mobile for iOS
> <https://github.com/notifications/mobile/ios/A2NO5CFC7GYP7OXDYIFTEKL5ARA2NA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJSHAYDINZZGE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
> and Android
> <https://github.com/notifications/mobile/android/A2NO5CESTKEZRIWHRDSBJN35ARA2NA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJSHAYDINZZGE2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
> Download it today!
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
https://github.com/llvm/llvm-project/pull/203949
More information about the libcxx-commits
mailing list