C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Implementing a movable container for immovable objects: std::box<T>

From: Ivan Matek <libbooze_at_[hidden]>
Date: Sat, 14 Dec 2024 23:31:46 +0100
On Sat, Dec 14, 2024 at 11:15 PM Oskars Putans <o.putaans_at_[hidden]> wrote:

>
> While these are similar to what I wanted to do (dynamically-allocated
> objects with value semantics), the motivation behind the proposal is very
> different.
> The main purpose for my proposal is to constrain unique pointers to ensure
> maximum memory-safety and not make copies.
> Feel free to correct me, but when, for example, moving Indirect objects, a
> new allocation takes place and the values are moved
>
> If I understood you correctly that is not the case, indirect/polymorphic
move does not allocate. From paper you can read the section
The valueless state and interaction with std::optional

Received on 2024-12-14 22:32:00