C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Relocation in C++

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Mon, 30 May 2022 09:54:52 -0600
On Mon, 30 May 2022 at 09:45, Maciej Cencora <m.cencora_at_[hidden]> wrote:

> Please provide me with an example of an immovable but relocatable
> type, that actually makes sense.
> I tried to come-up with such a type, but failed.
>

gsl::not_null<std::unique_ptr<C>> (or any smart pointer type)

std::lock_guard<M>, and many other guard types. (Yes, these can be made
movable, witness std::unique_lock, but that's often pointless complexity
since a moved-from instance is almost always immediately destroyed.)

Received on 2022-05-30 15:55:04