diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c615fe60..55cd47dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ + * Use `std::uninitialized_copy` in `VectorAdapter` to make sure copy constructors get called ([pull #465](https://github.com/bytedeco/javacpp/pull/465)) + ### March 8, 2021 version 1.5.5 * Ensure `System.gc()` never gets called with "org.bytedeco.javacpp.nopointergc" ([issue tensorflow/java#208](https://github.com/tensorflow/java/issues/208)) * Add `Info.immutable` to disable generating setters for public data members ([pull #461](https://github.com/bytedeco/javacpp/pull/461)) diff --git a/src/main/java/org/bytedeco/javacpp/tools/Generator.java b/src/main/java/org/bytedeco/javacpp/tools/Generator.java index 6bfa65288..74c6b5c52 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/Generator.java +++ b/src/main/java/org/bytedeco/javacpp/tools/Generator.java @@ -1119,7 +1119,7 @@ boolean classes(boolean handleExceptions, boolean defineAdapters, boolean conver out.println(" ptr = (P*)(operator new(sizeof(P) * vec.size(), std::nothrow_t()));"); out.println(" }"); out.println(" if (ptr) {"); - out.println(" std::copy(vec.begin(), vec.end(), ptr);"); + out.println(" std::uninitialized_copy(vec.begin(), vec.end(), ptr);"); out.println(" }"); out.println(" size = vec.size();"); out.println(" owner = ptr;");