C++26: std::indirect
cppdashboard.dev/r/2026/08/cpp26-std-indirectThis article discusses the proposed std::indirect feature in C++26, exploring its implications and usage. It provides insights into how this feature can enhance the language's capabilities.
From the article
C++26 adds two new vocabulary types in <memory> , introduced by P3019R14 (Coe, Peacock, Parent). From the abstract:
The class template indirect confers value-like semantics on a dynamically-allocated object. An indirect may hold an object of a class T . Copying the indirect will copy the object T . When an indirect<T> is accessed through a const access path, constness will propagate to the owned object.
The class template polymorphic confers value-like semantics on a dynamically-allocated object. A polymorphic<T> may hold an object of a class publicly derived from T . Copying the polymorphic<T> will copy the object of the derived type. When a polymorphic<T> is accessed through a const access path, constness will propagate to the owned object.
Share this resource