Using reference to avoid copy
With this commit a reference will be used during some structure
binding to avoid copies.
Tested:
CPUSensors and PSUSensors launched on physical machine, no
regression detected.
Signed-off-by: Zbigniew Kurzynski <zbigniew.kurzynski@intel.com>
Change-Id: I7aa270e440e9aadeca151acc6d9b73d7c4c4f40c
diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp
index 6aa077c..f4d4ed0 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -480,12 +480,12 @@
if (auto fileParts = splitFileName(inputPath))
{
- auto [type, nr, item] = *fileParts;
+ auto& [type, nr, item] = *fileParts;
if (map.count(item) != 0)
{
for (const auto& t : map.at(item))
{
- auto [suffix, level, direction, offset] = t;
+ auto& [suffix, level, direction, offset] = t;
auto attrPath =
boost::replace_all_copy(inputPath, item, suffix);
if (auto val = readFile(attrPath, scaleFactor))