C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::must_move()

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Mon, 31 Jan 2022 14:21:38 +0100
Hi,

On 31/01/2022 14:04, Avi Kivity via Std-Proposals wrote:
> std::move() silently falls back to copying if it cannot move. This can
> cause unexpected slowdown which is expensive to pinpoint.
>
>
> I propose std::must_move(), with deleted overloads for const T& and
> const T&&. This allows the user to request a diagnostic instead of
> falling back to a copy.
>

I'm not too fond of introducing yet another vocabulary verb for moving
(... tu quoque...), when this can be solved via static analysis instead:

> https://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html


My 2 c,

-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Received on 2022-01-31 13:21:43