mirror of
https://github.com/pybind/pybind11.git
synced 2025-03-25 18:07:43 +00:00
Remove some maybe-uninitialized warnings
In the Eigen matrix type_caster, resize the matrix instead of assigning with a new one when the matrix size needs to be adjusted. This can remove lots of compiling warnings about "maybe-uninitialized".
This commit is contained in:
parent
d2e7e8c687
commit
7d5a9b41aa
@ -317,7 +317,7 @@ struct type_caster<Type, enable_if_t<is_eigen_dense_plain<Type>::value>> {
|
||||
}
|
||||
|
||||
// Allocate the new type, then build a numpy reference into it
|
||||
value = Type(fits.rows, fits.cols);
|
||||
value.resize(fits.rows, fits.cols);
|
||||
auto ref = reinterpret_steal<array>(eigen_ref_array<props>(value));
|
||||
if (dims == 1) {
|
||||
ref = ref.squeeze();
|
||||
|
Loading…
Reference in New Issue
Block a user