Skip to content

Commit

Permalink
Fix wave identifier mapping by changing type to Constituent and remov…
Browse files Browse the repository at this point in the history
…ing unnecessary static_cast
  • Loading branch information
fbriol committed Nov 23, 2024
1 parent 7bcf585 commit d538810
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/fes/wave/table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Table {
if (index >= wave_identifiers_.size()) {
throw std::out_of_range("index out of range");
}
return waves_[wave_identifiers_[index]];
return waves_[static_cast<size_t>(wave_identifiers_[index])];
}

/// Get the wave properties from its identifier
Expand Down Expand Up @@ -335,7 +335,7 @@ class Table {
/// An array that maps linear indices (0, 1, 2, 3, ...) to the wave
/// identifiers defined in the table. If the table is complete, this mapping
/// is an identity mapping {0:0, 1:1, 2:2, ...}.
std::vector<size_t> wave_identifiers_{};
std::vector<Constituent> wave_identifiers_{};

/// Get a wave from the table
///
Expand Down
2 changes: 1 addition & 1 deletion src/library/wave/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Table::Table(const std::vector<std::string>& waves) {
wave_identifiers_.reserve(waves_.size());
for (const auto& item : waves_) {
if (item) {
wave_identifiers_.emplace_back(static_cast<size_t>(item->ident()));
wave_identifiers_.emplace_back(item->ident());
}
}
}
Expand Down

0 comments on commit d538810

Please sign in to comment.