r/cpp • u/User_Deprecated • May 17 '26
std::is_heap could be faster - Arthur O'Dwyer
https://quuxplusone.github.io/blog/2026/05/11/is-heap/
106
Upvotes
r/cpp • u/User_Deprecated • May 17 '26
19
u/FlyingRhenquest May 17 '26
Why not just submit a pull request to the library rather than saying they should implement it? It's open source code, you're allowed to contribute.
16
u/13steinj May 17 '26
Everyone casually ignoring
extract_containerlike it's 100% casual code that everyone has seen before.16
u/catlak_profesor_mfb May 17 '26
Nice!
5
u/Successful_Yam_9023 May 17 '26
I acknowledge the benchmark results, but
__first + __cand2 * __p + 1are not exactly shocking. A couple of trivial arithmetic operations in a function that also reads a bunch of memory..6
u/HommeMusical May 17 '26
Here's where
std::is_heapcallsstd::__is_heap_until, FYI: no surprises but I was curious.I made the mistake of reading the short implementation in the article first, and now I can't bring myself to take the time to really understand what the existing implementation is doing.
As the only remaining commenter said, "Nice!" (What happened to all those other comments?!)
3
u/[deleted] May 17 '26
[removed] — view removed comment
0
u/[deleted] May 17 '26
[deleted] — view deleted comment