Skip to content

Commit

Permalink
Added ValueIs helper template.
Browse files Browse the repository at this point in the history
  • Loading branch information
odlomax committed Sep 25, 2024
1 parent ea26e71 commit e8b38bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/atlas/array/ArrayViewVariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,12 @@ constexpr bool RankIs() {
return ((std::decay_t<View>::rank() == Ranks) || ...);
}

/// @brief Return true if View::non_const_value_type is any of Values...
template <typename View, typename... Values>
constexpr bool ValueIs() {
using Value = typename std::decay_t<View>::non_const_value_type;
return ((std::is_same_v<Value, Values>) || ...);
}

} // namespace array
} // namespace atlas

0 comments on commit e8b38bd

Please sign in to comment.