diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index 139a614..16c8cf9 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -897,7 +897,7 @@ template constexpr auto index = enum_index>(V); static_assert(index.has_value(), "magic_enum::enum_index enum value does not have a index."); - return index.value(); + return *index; } // Checks whether enum contains enumerator with such enum value. @@ -929,7 +929,7 @@ template constexpr optional fuse_one_enum(optional hash, E value) noexcept { if (hash.has_value()) { if (const auto index = enum_index(value); index.has_value()) { - return (hash.value() << log2(enum_count() + 1)) | index.value(); + return (*hash << log2(enum_count() + 1)) | *index; } } return {}; @@ -950,7 +950,7 @@ constexpr auto typesafe_fuse_enum(Es... values) noexcept { enum class enum_fuse_t : std::uintmax_t; const auto fuse = fuse_enum(values...); if (fuse.has_value()) { - return optional{static_cast(fuse.value())}; + return optional{static_cast(*fuse)}; } return optional{}; } @@ -991,7 +991,7 @@ std::basic_ostream& operator<<(std::basic_ostream& o template = 0> std::basic_ostream& operator<<(std::basic_ostream& os, optional value) { - return value.has_value() ? (os << value.value()) : os; + return value.has_value() ? (os << *value) : os; } } // namespace magic_enum::ostream_operators