RFR: 8319117: GrowableArray: Allow for custom initializer instead of copy constructor [v2]
Quan Anh Mai
qamai at openjdk.org
Tue Oct 31 12:51:33 UTC 2023
On Tue, 31 Oct 2023 12:36:58 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>>>Should this be Args&... args?
>>
>> Yes.
>>
>>>Also this method is returning a value instead of a reference, is it intentional?
>>
>> That is difficult to say. The caller can decided whether to capture the value by-reference or by-value either way.
>
>> > Should this be Args&... args?
>>
>> Yes.
>>
>
> Actually, no: We can't take by reference because most of the time we're calling `at_grow` and `at_put_grow` with rvalues and not lvalues, so we need move semantics for this to work. We have to keep the arguments as copying.
I see, in that case it must be `const Args&... args`. https://godbolt.org/z/aov8v38s9
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16409#discussion_r1377534942
More information about the hotspot-dev
mailing list