Memory Safety Without Lifetime Parameters

This proposal introduces a memory-safe reference type, T%, without lifetime annotations, aiming to simplify C++’s memory safety model. Safe references ensure exclusivity, allowing only one mutable or multiple shared references to a place. The proposal contrasts legacy lvalue- and rvalue-references with the new safe reference type, emphasizing the necessity of enforcing exclusivity. The content discusses constraint rules governing safe references, implementing both free function and non-static member function constraint types. Additionally, the concept of second-class references is introduced, providing a way to ensure memory safety without the need for a borrow checker. Overall, the proposal seeks to enhance memory safety in C++ by simplifying and clarifying reference types.

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3444r0.html

To top