Skip to content

Commit

Permalink
Replace usage of function "find" with "emplace".
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rapp committed Oct 3, 2023
1 parent a74e297 commit 6f021e7
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ static inline uint32 createMapping(ValueIterator valueIterator, uint32 numElemen

if (!std::isnan(value)) {
int32 nominalValue = (int32) value;
auto it = mapping.find(nominalValue);
auto it = mapping.emplace(nominalValue, Tuple<uint32> {numValues, 1});

if (it != mapping.end()) {
it->second.second++;
} else {
mapping.emplace(nominalValue, Tuple<uint32> {numValues, 1});
if (it.second) {
numValues++;
} else {
auto& entry = *(it.first);
Tuple<uint32>& tuple = entry.second;
tuple.second++;
}

numExamples++;
Expand Down

0 comments on commit 6f021e7

Please sign in to comment.