Skip to content

Commit

Permalink
Clearning the vector input before copying in vector specialization fo…
Browse files Browse the repository at this point in the history
…r Parse
  • Loading branch information
AyanRoy16 committed Oct 20, 2023
1 parent db8a0e3 commit 7ab3998
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libraries/JANA/Services/JParameterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ JParameter* JParameterManager::SetDefaultParameter(std::string name, T& val, std

// Always put val through the stringification/parsing cycle to be consistent with
// values passed in from config file, accesses from other threads
Parse(param->GetValue(),t1);
val = t1;
Parse(param->GetValue(),t);
val = t;
param->SetIsUsed(true);
return param;
}
Expand Down Expand Up @@ -367,6 +367,7 @@ template<typename T>
inline void JParameterManager::Parse(const std::string& value, std::vector<T> &val) {
std::stringstream ss(value);
std::string s;
val.clear(); // clearing the input vector to make remove dulication which can be caused due to val.push_back(t);
while (getline(ss, s, ',')) {
T t;
Parse(s, t);
Expand Down

0 comments on commit 7ab3998

Please sign in to comment.