Skip to content

Commit

Permalink
[PL] Invoke makeVectorUnique instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
renchao-lu committed Jan 16, 2019
1 parent 9acf0b6 commit e39af45
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ProcessLib/Utils/ProcessUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables(
if (var_names.empty())
OGS_FATAL("Config tag <%s> is not found.", tag.c_str());

// collect variable names to check if there are duplicates
std::set<std::string> cached_var_names;
std::vector<std::string> cached_var_names;

for (std::string const& var_name : var_names)
{
Expand All @@ -96,9 +95,12 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables(

vars.emplace_back(const_cast<ProcessVariable&>(*variable));

cached_var_names.insert(var_name);
cached_var_names.push_back(var_name);
}

// Eliminate duplicates in the set of variable names
BaseLib::makeVectorUnique(cached_var_names);

if (cached_var_names.size() != var_names.size())
OGS_FATAL("Found duplicates with config tag <%s>.", tag.c_str());

Expand Down

0 comments on commit e39af45

Please sign in to comment.