C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Automatic perfect forwarding is possible and not too complicated

From: Jeremy Rifkin <jeremy_at_[hidden]>
Date: Sat, 12 Apr 2025 12:47:03 -0500
I'm confused what problem this is trying to solve. What's wrong with
explicitly forwarding? In general most people seem to agree that
implicit action is bad and it's better to be explicit about things like this.

Cheers,
Jeremy

On Apr 12 2025, at 11:15 am, Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:

> On Friday, April 11, 2025, Lénárd Szolnoki <cpp_at_[hidden]> wrote:
>
>
>> Can't work safely in general. Just because an id is used last
>> lexically within a function it does not mean that it is the last used
>> reference to the object. A previous call could leak the reference and
>> a later call can use it.
>>
>> Similarly, implicitly moved strings can silently invalidate string_views.
>
>
> Yeah but isn't that kind of like saying that we shouldn't have
> 'std::string::c_str' because the pointers might become invalid if you
> do something with the string?
>
> If you're going to use a string_view to refer to the contents of an
> std::string, then you already need to make sure that the string
> doesn't change too much. So you wouldn't use a trigraph '&&&'
> reference to refer to a string if either:
> a) You've already stored the value of c_str()
> b) You're going to plunder the string's resources
>
>
> --
>
> Std-Proposals mailing list
>
> Std-Proposals_at_[hidden]
>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-04-12 17:47:07