Examining Destructive Move Semantics in C++26: Can Programmers Express Object-Consuming Functions?
By
signa11
A weekday bagel. Dependable, satisfying, no fuss.
Summary
The article discusses whether C++26 will include destructive move semantics, which would allow functions to consume objects without running their destructors on moved-from objects. It examines the proposed library function trivially_relocate_at as an example and questions whether programmers can express similar functionality themselves. The author explores the technical challenges of conveying that a function effectively destructs an object at the source location or constructs one at the destination, suggesting the answer is likely no based on existing examples that avoid this through manual memory management.
Key quotes
· 5 pulledCan I express a function that consumes an object? Meaning that its destructor is not run on the moved-from object?
Like the proposed library function trivially_relocate_at itself?
template <class T> T* trivially_relocate_at(T* dst, T* src);
That function signature does not convey that it effectively destructs an object at src, or the reverse problem, that it effectively constructs an object at dst.
I suspect the answer is no: The few examples I have found are avoiding it by doing manual memo
You might also wanna read
Why Average LLM Use Is Likely Destroying Value in Software Development
The author argues that, contrary to prevailing hype, the average use of Large Language Models (LLMs) is likely destroying value rather than
How AI Accelerated Prototyping: From Idea to Tangible in Record Time
The author reflects on how AI has transformed their prototyping workflow. Previously, the biggest bottleneck was the time needed to scaffold
GitLab 19.0 launches with Secrets Manager, agentic workflows, and self-hosted AI models
GitLab 19.0 has been released, positioning itself as an intelligent orchestration platform for DevSecOps. The release includes expanded secr
bit.ly·1d agoCentralizing Error Handling in Rust with Custom AppError Enums
This article discusses the importance of centralizing error handling in Rust applications using a custom AppError enum combined with map_err
Zig Devlog: Build System Rework Separates Maker and Configurer Processes
This devlog entry from the Zig programming language project announces a major rework of the build system, separating the maker process from
Study finds most developers refuse to code without AI, raising quality concerns
A February 2026 study by AI research lab METR reveals that most developers now refuse to work without AI coding tools. While these tools hel
