frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

The PImpl idiom and the C++26 std:indirect type

https://mariusbancila.ro/blog/2026/07/23/the-pimpl-idiom-and-the-cpp26-stdindirect-type/
20•signa11•59m ago

Comments

shevy-java•39m ago
C++ is getting more and more complex. It used to be said that people use only a small percentage of it when writing C++, but I am beginning to think that the cake is a lie here.
feelamee•22m ago
where "more and more complex" do u see in this article? This is a basic C++ idiom, which constantly used by developers
konstmonst•13m ago
std::indirect looks for me like another pointless c++ thing that already works with forward pointer declaration. You can add it to another ton of pointless things C++ adds without fixing the old ones. The issue with c++ is that it is so big, that everyone uses some kind of dialect of it and the fancier it gets, the less readable it becomes and the more magic happens behind the curtains. A developer of a C++ codebase now has to learn a specific meta language of this codebase. Fuck that, I have enough languages and their idiosynchronies to remember for my work now. After using Go for a pair of years returning to C++ is like coming back to a big archaic mess. I'll just go learn Rust instead and forget all those new useless C++ templates like std::indirect
seanhunter•11m ago
Yes. If anything, this is taking a complex yet common idiom and making it simpler.
dvratil•4m ago
I think the parent's point is that we started with raw pointers to implement PIMPL, then we had std::unique_ptr, and now we have std::indirect. So there are now three different ways how PIMPL can be implemented, each has its gotcha's and subtle differences that one needs to keep in mind. In large codebases you will now have to deal with all three solutions being used, depending on how old the code is.
coffeeaddict1•37m ago
This is actually useful, but despite it is another extra thing you will have to remember when reading C++ code. I guess with LLMs things aren't so bad.
skrebbel•16m ago
Why? It’s still the good (bad) old pimpl pattern. It just got a bit shorter. When reading you dont even need to grok “std::indirect”, you see the word pimpl and you know what’s going on.
zabzonk•21m ago
Hmm. Do people use PIMPL that much (I have used it, but rarely) that we need std library support (and testing, documentation, understanding)? Just asking.
neonz80•15m ago
They didn't add PImpl support, they added std::indirect which can be used for PImpl among other things.
seanhunter•14m ago
Back when I used to write C++ it was used all over the place. Admittedly that was a log time ago.
green7ea•14m ago
I remember using it all the time for the Windows headers because they pollutes the compilation unit like you wouldn't believe — the rule was to only include them in c/cpp files.
feverzsj•14m ago
Yes, if you actually care compile times.
flohofwoe•11m ago
This std::indirect thingie looks more like a general helper for any data 'dangling off' an object, not limited to pimpl.

Not sure how much pimpl is used in reality, but it's a pretty ok solution to speed up build times (apart from unity builds), because it avoids having to include headers that are only needed for the private state into the public interface header.

3form•17m ago
This looks great indeed - I wonder if there are any particular gotchas, though, as things often are in C++next land.

With many of the features coming into the language over time, I kinda wish that a bit more restricted subset of it eventually becomes a thing, but I know in practice it might as well be a completely different language. That, and I expect that still many other things have not been resolved as well as they are elsewhere, such as build system and dependency management (although I haven't touched this stack for a while now, so I would love to be surprised).

dvratil•6m ago
It's often used in libraries where you need to guarantee ABI compatibility. Fixing a bug or implementing a feature may require adding a new member into the class, which would change its size (thus break ABI compatibility). PIMPL is the typical solution here, since the inner/impl class is not part of the public ABI.

I also like to use it sometimes to "hide" private methods and their documentation into PIMPL, so the public header is kept clean.

Rotten Tomato audience scores without the push votes

https://popcorngap.com/
1•thinkingemote•6m ago•0 comments

Naming a pattern in AI-generated code: Modular Mirage

1•ErsanG•7m ago•0 comments

Chess Legend Vishy Anand Becomes Interim FIDE President

https://timesofindia.indiatimes.com/sports/chess/chess-legend-viswanathan-anand-steps-in-as-fide-...
1•mellosouls•10m ago•0 comments

Google launches selfie video sign-in

https://blog.mega.io/google-launches-selfie-video-sign-in
1•dotcoma•12m ago•0 comments

The Software Should Work conference worked

https://isaacvando.com/software-should-work-worked
1•crowdhailer•13m ago•0 comments

Cardiovascular Disease Infographic

https://world-heart-federation.org/resources/cardiovascular-disease-infographic/
1•teleforce•14m ago•0 comments

BuiltWith MCP Registry

https://builtwith.com/mcp-registry
1•garazy•16m ago•1 comments

Oracle severed 21,000 employees during an AI spending spree

https://finance.yahoo.com/technology/ai/articles/oracle-severed-21-000-employees-114500493.html
1•taubek•17m ago•0 comments

Calm technologies that excite me

https://abhi.now/blog/calm-technologies/
1•birdculture•18m ago•0 comments

Topologically Consistent Multi-View 3D Head Reconstruction

https://syntec-research.github.io/SHELLS/
1•Palmik•18m ago•0 comments

Beyond Static Summarization: Proactive Memory Extraction for LLM Agents

https://arxiv.org/abs/2601.04463
1•ankitg12•23m ago•0 comments

Ask HN: Convince me to not to shelve my app (I've decided to)

1•asdfbank•24m ago•0 comments

Computer science enrollment fell for the first time in 20 years

https://www.businessinsider.com/computer-science-enrollment-fell-after-chatgpts-rise-economist-sa...
3•EasternEuroDev•27m ago•0 comments

Show HN: 100% Free, private meeting notes that never leave your Mac

https://oatsnote.com/
3•jarvisceo•28m ago•0 comments

HN: FlowShelf –free,native macOS shelf/clipboard/screenshot app,on-device AI

https://flowshelf.app/
1•abukadery•29m ago•0 comments

Frontpages of the EU

https://frontpages.eu
1•brnt•30m ago•3 comments

AI coding agents should optimize for less owned code

https://www.openenergytransition.org/posts/ai-coding-agents-should-optimize-for-less-owned-code
1•lyoncy•31m ago•0 comments

Kimi K3 found 19 0days in latest Redis 8.8.0 in 1.5hrs

https://github.com/berabuddies/redis-poc
1•doanbactam•31m ago•1 comments

Snake fossil sheds light on why lizards lost their limbs and started slithering

https://theconversation.com/80-million-year-old-snake-fossil-sheds-light-on-why-lizards-lost-thei...
2•janandonly•35m ago•0 comments

Show HN: Sealos – deploy a full-stack GitHub repo and troubleshoot the live app

https://sealos.io/
3•dedicate•35m ago•1 comments

AI Overviews could push Reddit to end its $60M-a-year deal with Google

https://www.neowin.net/news/ai-overviews-could-push-reddit-to-end-its-60-million-a-year-deal-with...
2•01-_-•36m ago•0 comments

Amazon and Microsoft pivot cloud gaming strategies to target different players

https://www.cnbc.com/2026/07/23/amazon-microsoft-cloud-gaming.html
2•01-_-•36m ago•0 comments

Jolt: Clojure on Chez Scheme

https://yogthos.net/posts/2026-07-02-jolt.html
1•ephaeton•38m ago•1 comments

Show HN: Jharu – Open-Source AI and Dev Junk Cleaner for Mac and PC

https://github.com/riponcm/Jharu
1•riponcm•39m ago•0 comments

The Ever-Receding Pocket

https://zhenyi.gibber.blog/the-ever-receding-pocket
2•zhenyi•39m ago•0 comments

About the August 2026 Total Solar Eclipse

https://www.timeanddate.com/news/astronomy/10-things-aug-2026-eclipse
1•chmaynard•41m ago•0 comments

Agent Sabotage with Deceitful Commit Message;

https://github.com/MasihMoafi/Elpis
1•masihmoafi•42m ago•0 comments

On AI

https://jcs.org/2026/07/23/ai
2•ingve•42m ago•0 comments

Reaction: Scan Logs for Patterns and Take Action

https://reaction.ppom.me/intro/
1•joahua•44m ago•0 comments

Nathan Barley

https://en.wikipedia.org/wiki/Nathan_Barley
1•ustad•54m ago•0 comments