mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
Fix accidental copy of loop variable.
This commit is contained in:
parent
7b76c85daf
commit
0e59f786e1
@ -32,7 +32,7 @@ struct Initializer {
|
||||
Eigen::array<typename traits<Derived>::Index, traits<Derived>::NumDimensions>* indices,
|
||||
const InitList& vals) {
|
||||
int i = 0;
|
||||
for (auto v : vals) {
|
||||
for (const auto& v : vals) {
|
||||
(*indices)[traits<Derived>::NumDimensions - N] = i++;
|
||||
Initializer<Derived, N - 1>::run(tensor, indices, v);
|
||||
}
|
||||
@ -48,7 +48,7 @@ struct Initializer<Derived, 1> {
|
||||
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<Derived>::NumDimensions - 1] = i++;
|
||||
tensor.coeffRef(*indices) = v;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user