Skip to content

Commit

Permalink
rename: key to value for find function
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Aug 1, 2024
1 parent 2b9f3d9 commit 56070c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions common/src/KokkosFFT_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ auto convert_negative_shift(const ViewType& view, int _shift, int _axis) {
}

template <typename ContainerType, typename ValueType>
bool is_found(ContainerType& values, const ValueType& key) {
bool is_found(ContainerType& values, const ValueType& value) {
using value_type = KokkosFFT::Impl::base_container_value_type<ContainerType>;
static_assert(std::is_same_v<value_type, ValueType>,
"Container value type must match ValueType");
return std::find(values.begin(), values.end(), key) != values.end();
return std::find(values.begin(), values.end(), value) != values.end();
}

template <typename ContainerType>
Expand Down Expand Up @@ -158,16 +158,16 @@ bool is_transpose_needed(std::array<int, DIM> map) {
}

template <typename ContainerType, typename ValueType>
std::size_t get_index(ContainerType& values, const ValueType& key) {
std::size_t get_index(ContainerType& values, const ValueType& value) {
using value_type = KokkosFFT::Impl::base_container_value_type<ContainerType>;
static_assert(std::is_same_v<value_type, ValueType>,
"Container value type must match ValueType");
auto it = std::find(values.begin(), values.end(), key);
auto it = std::find(values.begin(), values.end(), value);
std::size_t index = 0;
if (it != values.end()) {
index = it - values.begin();
} else {
throw std::runtime_error("key is not included in values");
throw std::runtime_error("value is not included in values");
}

return index;
Expand Down

0 comments on commit 56070c9

Please sign in to comment.