RFR: 8319117: GrowableArray: Allow for custom initializer instead of copy constructor [v2]

Johan Sjölen jsjolen at openjdk.org
Tue Oct 31 12:27:08 UTC 2023


On Tue, 31 Oct 2023 12:19:57 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Hi, 
>> 
>> When using at_put and at_put_grow you can provide a value which will be supplied to the constructor of each element. In other words, you can intialize each element through a copy constructor.
>> 
>> I suggest that we also provide a function equivalent where the function is provided a pointer to the memory to be initialized. This can be used for `NONCOPYABLE` classes, for example.
>> 
>> This is implemented using a SFINAE pattern because `nullptr` introduces ambiguity if you use static overload.
>> 
>> Currently running tier1-tier4.
>
> Johan Sjölen has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Use variadic templates for in-place construction
>  - Two tests

src/hotspot/share/memory/allocation.hpp line 500:

> 498:     return ptr;
> 499:   }
> 500: 

This should probably be a separate RFE.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16409#discussion_r1377500706


More information about the hotspot-dev mailing list