RFR: 8319117: GrowableArray: Allow for custom initializer instead of copy constructor [v12]
Johan Sjölen
jsjolen at openjdk.org
Tue Nov 7 12:09:35 UTC 2023
On Tue, 7 Nov 2023 05:14:55 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> > [...] The `at_put_grow_with` lambda takes two arguments, the latter being a boolean flag indicating whether or not this is the last element. It's perhaps not the most elegant, but I don't think having two templates would do us any good here.
>
> I don't see the point of the "last element" flag for the _with function argument. It is used to change what was in the old code a copy-assign into a copy-construct, but so what? A class should be either non-copyable (neither by constructor nor by assignment), or it should be copyable (both by constructor and by assignment). Anything else is weird and probably broken. So avoiding copy-assignment isn't really buying anything except API complexity.
Would you prefer that we instantiate the element with global placement new?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16409#issuecomment-1798375378
More information about the hotspot-dev
mailing list