C++ Logo

std-proposals

Advanced search

Re: [std-proposals] explicit modifier for R-value references

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Mon, 19 Jun 2023 15:56:15 +0100
On Mon, 19 Jun 2023 at 13:56, Bo Persson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Perhaps we could introduce a use(std::nomove(arg)); to use in this case?
>

Perhaps just use((arg)) - i.e. adding an extra set of parentheses, by
analogy to decltype(id) vs. decltype((id))?

On Mon, 19 Jun 2023 at 14:04, Arthur O'Dwyer via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Mon, Jun 19, 2023 at 8:57 AM Ville Voutilainen via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> I completely fail to see what is "explicit" about any of this. It's
>> the polar opposite of explicit.
>
>
> Hear, hear; +1 what Ville said.
> Also, Ed, IIRC ;) you have an extremely active proposal for
> void SetVector(vector<int>&& arg) {
> vec = reloc arg; // ta-da
> }
> template<class T>
> void SetVector(T&& arg) {
> vec = reloc arg; // ta-da
> }
> to do exactly what OP wanted, and (1) with less syntax, (2) with the sigil
> `reloc` appearing at the point of the move/forward/relocation, instead of
> spookily at a distance. I don't see why you *in particular* would want
> this kind of implicit double-move-bug factory in addition to that other
> safer mechanism.
>

In this forum, it's appropriate to evaluate proposals on their own merits
without emotional attachment to any other proposal - including one's own.
There may well be things I can learn from this by approaching it in a
spirit of openness.

Received on 2023-06-19 14:56:28