1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-10 23:44:29 +00:00

Fix regression of enum_cast<>() when used with refs (EnumT& vs EnumT) (#16)

This commit is contained in:
Alexander Karatarakis 2019-10-03 00:02:39 -07:00 committed by Daniil Goncharov
parent cbbb6dd8f1
commit 3f0aad9f74
2 changed files with 2 additions and 1 deletions

View file

@ -437,7 +437,7 @@ template <typename E>
// Obtains enum value from integer value.
// Returns std::optional with enum value.
template <typename E>
[[nodiscard]] constexpr auto enum_cast(std::underlying_type_t<E> value) noexcept -> detail::enable_if_enum_t<E, std::optional<std::decay_t<E>>> {
[[nodiscard]] constexpr auto enum_cast(std::underlying_type_t<std::decay_t<E>> value) noexcept -> detail::enable_if_enum_t<std::decay_t<E>, std::optional<std::decay_t<E>>> {
using D = std::decay_t<E>;
if (enum_traits<D>::index(static_cast<D>(value)) != -1) {