product
C++26 to Introduce std::indirect, a New Type Aimed at Simpli
24 Jul 2026
C++26 to Introduce std::indirect, a New Type Aimed at Simplifying the PImpl Idiom
What happened
- C++26 introduces std::indirect, a new vocabulary type defined in the <memory> header.
- std::indirect is designed to simplify the implementation of the PImpl idiom in C++.
- PImpl stands for Pointer to implementation.
- The Rule of Five is a guideline stating that when a class defines one special member function for resource management, it should define all five (destructor, copy constructor, copy assignment operator, move constructor, move assignment operator).
- std::indirect is intended for class members that are dynamically allocated but need to behave like values.
- std::indirect is designed to be used instead of std::unique_ptr where unique_ptr's semantics (not copyable, does not propagate const, and can be null) are not appropriate.
Numbers
- The Rule of Five requires defining 5 special member functions.
- std::indirect is slated for C++26.
Why founders should care
- Startups building long-lived C++ codebases may want to track C++26 compiler support timelines, as std::indirect could simplify future maintenance of PImpl-based designs.
- Early awareness of std::indirect may help engineering teams plan refactors that reduce manual special-member-function boilerplate, though actual benefits depend on eventual compiler and standard library support.
- Teams evaluating ABI-stability strategies (a common PImpl use case) may want to monitor how std::indirect could affect design decisions once it becomes widely available.