Zero-initilizing array

This commit is contained in:
Cheng
2025-07-21 17:40:33 -07:00
parent 48e796bb91
commit f189face9d

View File

@@ -58,7 +58,7 @@ inline std::array<T, MAX_NDIM> fixed_vector(const std::vector<T>& vec) {
throw std::runtime_error(
fmt::format("ndim can not be larger than {}.", MAX_NDIM));
}
std::array<T, MAX_NDIM> result;
std::array<T, MAX_NDIM> result = {};
std::copy_n(vec.begin(), vec.size(), result.begin());
return result;
}