Abstract
Since the adoption of [P0784R7] in C++20, constant expressions can include dynamic memory allocation; yet support for smart pointers extends only to std::unique_ptr (since [P2273R3] in C++23). As at runtime, smart pointers can encourage hygienic memory management during constant evaluation; and with no remaining technical obstacles, parity between runtime and compile-time support for smart pointers should reflect the increased maturity of language support for constant expression evaluation. We therefore propose that std::shared_ptr and appropriate classes and template member functions from [smartptr], as well as smart pointer specialisations of std::atomic from [util.smartptr.atomic] permit constexpr evaluation.
| Original language | English |
|---|---|
| Type | Programming Language Standard |
| Media of output | |
| Publisher | International Organization for Standardization (ISO) |
| Number of pages | 39 |
| Place of Publication | Geneva |
| Publication status | Published - 30 Jun 2025 |
UN SDGs
This output contributes to the following UN Sustainable Development Goals (SDGs)
-
SDG 8 Decent Work and Economic Growth
-
SDG 9 Industry, Innovation, and Infrastructure
-
SDG 11 Sustainable Cities and Communities
Keywords
- C++
- constexpr
- smart pointers
- C++26
Fingerprint
Dive into the research topics of 'constexpr std::shared_ptr and friends'. Together they form a unique fingerprint.Cite this
- APA
- Author
- BIBTEX
- Harvard
- Standard
- RIS
- Vancouver