RFR: 8314571: GrowableArray should move its old data and not copy it [v2]

Johan Sjölen jsjolen at openjdk.org
Mon Aug 21 09:54:07 UTC 2023


> Given some `GrowableArray<E>` where `E` is non-copyable with a move constructor will currently  fail to compile. This is because `GrowableArray`'s expand and shrink calls the copy constructor. We cast the values to rvalues (akin to `std::move`) to instead call the move constructor if available. If there is no move constructor but there is a copy constructor, then that will be called instead.

Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:

  Use std::move

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15344/files
  - new: https://git.openjdk.org/jdk/pull/15344/files/27e9d7e7..eb3dbf32

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15344&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15344&range=00-01

  Stats: 4 lines in 1 file changed: 2 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/15344.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15344/head:pull/15344

PR: https://git.openjdk.org/jdk/pull/15344


More information about the hotspot-dev mailing list