You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be nice to add the to_underlying function that was added C++23. I've implemented it locally on my C++14 codebase and figured it could be useful here.
#include<type_traits>/** * @brief Converts an enum class value to it's underlying type'd value. * * @tparam Enum: Enum class type. * @param e: Enum class value. * @return constexpr auto*/template <typename Enum>
constexprautoto_underlying(const Enum e) noexcept ->
typename std::underlying_type_t<Enum>
{
returnstatic_cast<typename std::underlying_type_t<Enum>>(e);
}
The text was updated successfully, but these errors were encountered:
I think it would be nice to add the
to_underlying
function that was added C++23. I've implemented it locally on my C++14 codebase and figured it could be useful here.The text was updated successfully, but these errors were encountered: