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

Stefan Karlsson stefank at openjdk.org
Tue Oct 31 08:35:31 UTC 2023


On Sun, 29 Oct 2023 14:00:25 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.

I'd also like to get a better understand how this is intended to use. It also lacks tests for this feature. Maybe you could write a gtest show-casing how this is supposed to be used?

I'd prefer if there was a way to get rid of the SFINAE and the code duplication, if possible.

There are a lot of inconsistencies of the formatting within the patch itself and with regards to the style used in the rest of the code. Could you take an extra pass add appropriate whitespaces and newlines?

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

PR Comment: https://git.openjdk.org/jdk/pull/16409#issuecomment-1786738435


More information about the hotspot-dev mailing list