RFR: 8319117: GrowableArray: Allow for custom initializer instead of copy constructor [v7]
Quan Anh Mai
qamai at openjdk.org
Wed Nov 1 03:54:01 UTC 2023
On Tue, 31 Oct 2023 14:27:30 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> src/hotspot/share/utilities/growableArray.hpp line 411:
>>
>>> 409: if (i >= this->_capacity) grow(i);
>>> 410: for (int j = this->_len; j <= i; j++)
>>> 411: new (&this->_data[j]) E(args...);
>>
>> Use global placement new, e.g. `::new`. Also below, in `at_put_grow`
>
> Style: Missing braces around the for-loop body. Also below in `at_put_grow`.
I believe you also need to destroy the old object before initialise a new one.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16409#discussion_r1378366004
More information about the hotspot-dev
mailing list