From 8267d2860b3a80815da49d33b3ef445d5897b6c4 Mon Sep 17 00:00:00 2001 From: Bela Schaum Date: Sat, 5 Mar 2022 20:56:17 +0100 Subject: [PATCH] remove std:: from optionals to enable again MAGIC_ENUM_USING_ALIAS_OPTIONAL (#154) --- include/magic_enum.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index 5b916be..9526b3c 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -914,23 +914,23 @@ template > namespace fusion_detail { template -constexpr std::optional fuse_one_enum(std::optional hash, E value) noexcept { +constexpr optional fuse_one_enum(optional 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() + 1)) | (index.value() + 1); } } - return std::nullopt; + return {}; } template -constexpr std::optional fuse_enum(E value) noexcept { +constexpr optional fuse_enum(E value) noexcept { return fuse_one_enum(0, value); } template -constexpr std::optional fuse_enum(E head, Es... tail) noexcept { +constexpr optional fuse_enum(E head, Es... tail) noexcept { return fuse_one_enum(fuse_enum(tail...), head); }