Date: Mon, 30 May 2022 18:42:37 +0200
Hi,
On 30/05/2022 18:23, Arthur O'Dwyer via Std-Proposals wrote:
> A type that is immobile/immovable cannot be relocatable, because it's
> not movable. Immobility is for types that cannot be moved from place to
> place — like `std::mutex`, for example. Typically they cannot be moved
> because /if you moved them then bad things would happen/.
That's not the only case, though. Take lock_guard/scoped_lock -- they're
immovable because the introduction of a moved-from state is strictly
more expensive than making it immovable (at a bare minimum, a branch
would be needed in the destructor). Conceptually speaking, however, a
lock_guard could be _relocated_...?
(Of course, now we can open the bikeshedding on whether something called
`scoped_lock` should be able to be relocated _at all_, and therefore
possibly "escape" the scope...)
My 2 c,
On 30/05/2022 18:23, Arthur O'Dwyer via Std-Proposals wrote:
> A type that is immobile/immovable cannot be relocatable, because it's
> not movable. Immobility is for types that cannot be moved from place to
> place — like `std::mutex`, for example. Typically they cannot be moved
> because /if you moved them then bad things would happen/.
That's not the only case, though. Take lock_guard/scoped_lock -- they're
immovable because the introduction of a moved-from state is strictly
more expensive than making it immovable (at a bare minimum, a branch
would be needed in the destructor). Conceptually speaking, however, a
lock_guard could be _relocated_...?
(Of course, now we can open the bikeshedding on whether something called
`scoped_lock` should be able to be relocated _at all_, and therefore
possibly "escape" the scope...)
My 2 c,
-- Giuseppe D'Angelo
Received on 2022-05-30 16:42:40