Skip to content

Commit 7c81682

Browse files
committed
modernize-avoid-c-arrays
1 parent 7bc2d1b commit 7c81682

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

PWGDQ/Core/HistogramManager.cxx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <Rtypes.h>
2626
#include <RtypesCore.h>
2727

28+
#include <array>
2829
#include <cstdint>
2930
#include <iostream>
3031
#include <list>
@@ -806,7 +807,7 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values)
806807
bool isFillLabelx = kFALSE;
807808
// TODO: At the moment, maximum 20 dimensions are foreseen for the THn histograms. We should make this more dynamic
808809
// But maybe its better to have it like to avoid dynamically allocating this array in the histogram loop
809-
double fillValues[20] = {0.0};
810+
std::array<double, 20> fillValues{};
810811
int varX = -1, varY = -1, varZ = -1, varT = -1, varW = -1;
811812

812813
// loop over the histogram and std::list
@@ -942,18 +943,18 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values)
942943
if (varW > kNothing) {
943944
if (isSparse) {
944945
if (auto* hn = dynamic_cast<THnSparse*>(h)) {
945-
hn->Fill(fillValues, values[varW]);
946+
hn->Fill(fillValues.data(), values[varW]);
946947
}
947948
} else if (auto* hn = dynamic_cast<THn*>(h)) {
948-
hn->Fill(fillValues, values[varW]);
949+
hn->Fill(fillValues.data(), values[varW]);
949950
}
950951
} else {
951952
if (isSparse) {
952953
if (auto* hn = dynamic_cast<THnSparse*>(h)) {
953-
hn->Fill(fillValues);
954+
hn->Fill(fillValues.data());
954955
}
955956
} else if (auto* hn = dynamic_cast<THn*>(h)) {
956-
hn->Fill(fillValues);
957+
hn->Fill(fillValues.data());
957958
}
958959
}
959960
} // end else

0 commit comments

Comments
 (0)