C++ Logo

std-discussion

Advanced search

Re: Potential defect in the behaviour of the rvalue constructors for std::tuple and std::pair.

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Sat, 11 Nov 2023 18:51:42 +0200
On Sat, 11 Nov 2023 at 12:38, Bryan Wong via Std-Discussion
<std-discussion_at_[hidden]> wrote:
> Is it documented anywhere that the standard library doesn't support copyable-but-non-movable types? If not, do you think there's any benefit to adding it? Or do you think it's unnecessary as such types rarely make an appearance?

I think it's unnecessary. Outside move-only types, it is generally
understood that move is an optimization of copy, and having
the operation but completely banning its optimized variant makes
little sense. When a copy is valid, it's pretty much so in everywhere
in the language that an attempt to move will happily just use a copy
if the optimization isn't available.

Received on 2023-11-11 16:51:55