RFR: 8319117: GrowableArray: Allow for custom initializer instead of copy constructor [v8]
Kim Barrett
kbarrett at openjdk.org
Wed Nov 1 17:25:05 UTC 2023
On Wed, 1 Nov 2023 15:23:28 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> src/hotspot/share/utilities/growableArray.hpp line 420:
>>
>>> 418:
>>> 419: template<typename... Args>
>>> 420: void at_put_grow(int i, const E& elem, const Args&... args) {
>>
>> I don't understand the point of this change, as the old code defaulted fill object seems like it should be fine
>> for at_put_grow, which requires the element type to be copyable/assignable anyway to store the new element
>> value.
>
> Sorry, I'm not sure what you're missing here. This change enables in-place construction of the objects and the `Args...` doesn't have to be of type `E`. Is the issue with the default being removed?
My point is that the old code was fine. Copy-assigning the fill argument
(either defaulted or passed in) had to work (E can't be non-copyable), because
at_put_grow requires E to be copy-assignable in order to install the new value
at index i.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16409#discussion_r1379094175
More information about the hotspot-dev
mailing list