constexpr std::shared_ptr and friends

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.

Authors

Publication Details

Journal
The UWS Academic Portal (University of the West of Scotland)
Published
2025-06-30
Primary Topic
Logic, programming, and type systems
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

constexpr std::shared_ptr and friends

Paul; id_orcid 0000-0002-4781-9377 Keir, Hana Dusíková
The UWS Academic Portal (University of the West of Scotland)
Logic, programming, and type systems
article

constexpr std::shared_ptr and friends

Paul; id_orcid 0000-0002-4781-9377 Keir, Hana Dusíková
article en

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.

The UWS Academic Portal (University of the West of Scotland)
Openalex Percentile: Top 15%
Logic, programming, and type systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

constexpr std::shared_ptr and friends — Paul; id_orcid 0000-0002-4781-9377 Keir, Hana Dusíková · The UWS Academic Portal (University of the West of Scotland) (2025) | TGRS Research Map | TGRS