Std: Is_heap Could Be Faster
The article discusses potential inefficiencies in the implementation of std::is_heap in C++ standard libraries, noting that it unnecessarily requires random access iterators despite being implementable with forward traversal. A proposed alternative implementation reduces redundant arithmetic and improves performance in benchmarks. The author highlights that major standard library implementations, including libc++, libstdc++, and MS STL, exhibit similar inefficiencies.
- ▪std::is_heap currently requires random_access_range, even though it could work with forward traversal.
- ▪A more efficient implementation using forward iterators reduces redundant arithmetic operations.
- ▪Benchmark results show performance improvements of up to 39% after optimizing the function.
2 outlets in our directory ran this story, first to last over 8 hours. All of the coverage we found sits in one bucket: centre. That one-sidedness is itself worth noticing.
Hacker News (Newest) files mainly under programming. We currently carry 5,306 of its stories.
Story provenance
Source · retrieval · rights · ranking — open for full record
inspect →
Story provenance
Attribution is not the same as permission. This drawer separates discovery metadata, excerpts, WeSearch-generated summaries, reuse status, and whether the publisher receives the visit. Nothing here claims a legal grant the publisher has not made.
Record
| Original publisher | Arthur O’Dwyer |
| Canonical URL | https://quuxplusone.github.io/blog/2026/05/11/is-heap/ |
| Publication time | Sun, 17 May 2026 08:24:56 +0000 |
| Retrieval time | 2026-05-17T08:52:12.990Z |
| Last seen | 2026-05-17T08:52:12.990Z |
| Headline source | Publisher (no WeSearch rewrite) |
| Excerpt source | publisher body |
| Excerpt method | First ~120 words (~800 chars) of extracted publisher body, fair-use limited. |
| Summary | WeSearch · cerebras-chat (WeSearch summarizer) |
| Summary source text | contentText |
| Citation coverage | Summary is a WeSearch-generated derivative; primary citation is the original publisher URL. |
| Cluster | W-SiqwVIuC5M · 2 stories |
| Cluster logic | Grouped by semantic title/content similarity across sources within a rolling window. Same-publisher template collisions are excluded from coverage comparison. |
| Ranking reason | Story pages are not engagement-ranked. Hub feeds use recency, with optional source-diversified chronological ordering (cap consecutive stories per source). No personalized ranking. |
| Publisher visit | Yes — open original |
| Substitutes article? | No — link-out required for full text |
Rights status (four layers)
WeSearch handling by dimension
| Indexing | May the item be indexed (stored, ranked, made findable)? | Allowed |
| Snippet | May a short excerpt of the publisher's text be shown? | Allowed |
| AI summary | May WeSearch generate its own short summary of the article? | Limited |
| Retrieval / RAG | May the content be exposed for third-party retrieval-augmented generation? | Not asserted |
| Model training | May the content be used to train AI models? | Not asserted |
| Commercial reuse | May the content be reused commercially? | Not permitted |
Basis: Derived from the published RSS/Atom feed. Contact: [email protected]. Reviewed: 2026-07-24.
Opening excerpt (first ~120 words) tap to expand
std::is_heap could be faster The other day I was noodling around with some libc++ unit-test code that looked roughly like this (Godbolt): template<class A> auto extract_container(A& a) { struct UnwrapAdaptor : A { A::container_type& cc = A::c; }; return UnwrapAdaptor(a).cc; } template<class Adaptor> void test_push_range(bool is_heapified) { int in1[] = {1,3,7}; int in2[] = {2,4,5,6}; int expected[] = {1,3,7,2,4,5,6}; Adaptor a; a.push_range(in1); a.push_range(in2); if (auto c = extract_container(a); is_heapified) { assert(std::ranges::is_heap(c)); assert(std::ranges::is_permutation(c, expected)); } else { assert(std::ranges::equal(c, expected)); } } int main() { test_push_range<std::stack<int>>(false); test_push_range<std::queue<int>>(false);…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Arthur O’Dwyer.