RFR: 8319117: GrowableArray: Allow for custom initializer instead of copy constructor [v12]
Kim Barrett
kbarrett at openjdk.org
Tue Nov 7 05:17:30 UTC 2023
On Mon, 6 Nov 2023 16:45:39 GMT, Johan Sjölen <jsjolen 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.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16409#issuecomment-1797837188
More information about the hotspot-dev
mailing list