Skip to content
Snippets Groups Projects

GSF use std::move, instead of .release() in few place that is applicable

3 files
+ 6
6
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -55,7 +55,7 @@ doStateAssembly(Cache& cache, const double newWeight)
@@ -55,7 +55,7 @@ doStateAssembly(Cache& cache, const double newWeight)
Trk::MultiComponentState assembledState;
Trk::MultiComponentState assembledState;
assembledState.reserve(cacheSize);
assembledState.reserve(cacheSize);
for (auto& component : cache.multiComponentState) {
for (auto& component : cache.multiComponentState) {
assembledState.emplace_back(component.first.release(), component.second);
assembledState.emplace_back(std::move(component.first), component.second);
}
}
// Reset the cache before leaving
// Reset the cache before leaving
reset(cache);
reset(cache);
@@ -66,7 +66,7 @@ doStateAssembly(Cache& cache, const double newWeight)
@@ -66,7 +66,7 @@ doStateAssembly(Cache& cache, const double newWeight)
const double scalingFactor =
const double scalingFactor =
cache.validWeightSum > 0. ? newWeight / cache.validWeightSum : 1.;
cache.validWeightSum > 0. ? newWeight / cache.validWeightSum : 1.;
for (auto& component : cache.multiComponentState) {
for (auto& component : cache.multiComponentState) {
assembledState.emplace_back(component.first.release(),
assembledState.emplace_back(std::move(component.first),
component.second * scalingFactor);
component.second * scalingFactor);
}
}
// Reset the cache before leaving
// Reset the cache before leaving
@@ -95,7 +95,7 @@ Trk::MultiComponentStateAssembler::addComponent(
@@ -95,7 +95,7 @@ Trk::MultiComponentStateAssembler::addComponent(
return false;
return false;
}
}
cache.validWeightSum += componentParameters.second;
cache.validWeightSum += componentParameters.second;
cache.multiComponentState.emplace_back(componentParameters.first.release(),
cache.multiComponentState.emplace_back(std::move(componentParameters.first),
componentParameters.second);
componentParameters.second);
return true;
return true;
}
}
@@ -111,7 +111,7 @@ Trk::MultiComponentStateAssembler::addMultiState(
@@ -111,7 +111,7 @@ Trk::MultiComponentStateAssembler::addMultiState(
double sumW(0.);
double sumW(0.);
for (auto& component : multiComponentState) {
for (auto& component : multiComponentState) {
sumW += component.second;
sumW += component.second;
cache.multiComponentState.emplace_back(component.first.release(),
cache.multiComponentState.emplace_back(std::move(component.first),
component.second);
component.second);
}
}
multiComponentState.clear();
multiComponentState.clear();
Loading