C++ Logo

std-proposals

Advanced search

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

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Mon, 19 Jun 2023 17:01:51 +0200
pon., 19 cze 2023 o 16:56 Edward Catmur via Std-Proposals
<std-proposals_at_[hidden]> napisaƂ(a):
>
> 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))?
>

I do not think this is a good idea, `decltype(id)` works differently
because it's different from other versions.
One get object named by a given identifier, where the second is an
arbitrary expression.
In ` use((arg))` and ` use(arg)` is exactly the same thing, expression.

> 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.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-06-19 15:02:05