24 #ifndef SRC_COMMON_UTILS_H 25 #define SRC_COMMON_UTILS_H 27 #include <type_traits> 42 template <
typename E,
typename SE>
45 return static_cast<E>(
static_cast<std::underlying_type_t<SE>
>(v));
57 template <
typename SE,
typename E>
58 constexpr SE
as_enum(
const E val) noexcept
60 return static_cast<SE>(val);
73 bool is_in(E check, std::initializer_list<E> list)
75 return std::any_of(std::cbegin(list), std::cend(list), [&check](E e)
constexpr SE as_enum(const E val) noexcept
Convert plain old enumeration to a strongly typed enum.
constexpr E as_cenum(const SE v) noexcept
Convert a strongly typed enum to an old plain c enum.
Copyright (c) 2017-2021 Arm Limited.
bool is_in(E check, std::initializer_list< E > list)
Check if the given value is in the given enum value list.