From e8b38bd8de4a2458883e3d104c24752e2b0851dc Mon Sep 17 00:00:00 2001 From: odlomax Date: Wed, 25 Sep 2024 15:52:58 +0100 Subject: [PATCH] Added ValueIs helper template. --- src/atlas/array/ArrayViewVariant.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/atlas/array/ArrayViewVariant.h b/src/atlas/array/ArrayViewVariant.h index 34e153303..0ea3f87c6 100644 --- a/src/atlas/array/ArrayViewVariant.h +++ b/src/atlas/array/ArrayViewVariant.h @@ -85,5 +85,12 @@ constexpr bool RankIs() { return ((std::decay_t::rank() == Ranks) || ...); } +/// @brief Return true if View::non_const_value_type is any of Values... +template +constexpr bool ValueIs() { + using Value = typename std::decay_t::non_const_value_type; + return ((std::is_same_v) || ...); +} + } // namespace array } // namespace atlas