From 0e59f786e10cbdc9443ba2547bd01428475602d8 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Tue, 5 May 2020 21:35:38 +0000 Subject: Fix accidental copy of loop variable. --- unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h b/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h index 33edc49e3..26a3818f3 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h @@ -32,7 +32,7 @@ struct Initializer { Eigen::array::Index, traits::NumDimensions>* indices, const InitList& vals) { int i = 0; - for (auto v : vals) { + for (const auto& v : vals) { (*indices)[traits::NumDimensions - N] = i++; Initializer::run(tensor, indices, v); } @@ -48,7 +48,7 @@ struct Initializer { const InitList& vals) { int i = 0; // There is likely a faster way to do that than iterating. - for (auto v : vals) { + for (const auto& v : vals) { (*indices)[traits::NumDimensions - 1] = i++; tensor.coeffRef(*indices) = v; } -- cgit v1.2.3