mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
remove std:: from optionals to enable again MAGIC_ENUM_USING_ALIAS_OPTIONAL (#154)
This commit is contained in:
parent
ca89c5425b
commit
8267d2860b
1 changed files with 4 additions and 4 deletions
|
|
@ -914,23 +914,23 @@ template <typename E, typename BinaryPredicate = std::equal_to<char>>
|
|||
namespace fusion_detail {
|
||||
|
||||
template <typename E>
|
||||
constexpr std::optional<std::uintmax_t> fuse_one_enum(std::optional<std::uintmax_t> hash, E value) noexcept {
|
||||
constexpr optional<std::uintmax_t> fuse_one_enum(optional<std::uintmax_t> hash, E value) noexcept {
|
||||
if (hash.has_value()) {
|
||||
if (const auto index = enum_index(value); index.has_value()) {
|
||||
// Add 1 to prevent matching 2D fusions with 3D fusions etc.
|
||||
return (hash.value() << detail::log2(enum_count<E>() + 1)) | (index.value() + 1);
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
return {};
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
constexpr std::optional<std::uintmax_t> fuse_enum(E value) noexcept {
|
||||
constexpr optional<std::uintmax_t> fuse_enum(E value) noexcept {
|
||||
return fuse_one_enum(0, value);
|
||||
}
|
||||
|
||||
template <typename E, typename... Es>
|
||||
constexpr std::optional<std::uintmax_t> fuse_enum(E head, Es... tail) noexcept {
|
||||
constexpr optional<std::uintmax_t> fuse_enum(E head, Es... tail) noexcept {
|
||||
return fuse_one_enum(fuse_enum(tail...), head);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue