Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions include/zeus/expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define ZEUS_EXPECTED_VERSION_MAJOR 1
#define ZEUS_EXPECTED_VERSION_MINOR 3
#define ZEUS_EXPECTED_VERSION_PATCH 2
#define ZEUS_EXPECTED_VERSION_PATCH 3

#if defined(_MSVC_LANG)
#define ZEUS_EXPECTED_CPLUSPLUS _MSVC_LANG
Expand All @@ -28,9 +28,9 @@ static_assert(false, "This expected variant requires C++17");

// Detect exception support
#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
#define ZEUS_EXPECTED_THROW(e) (throw (e))
#define ZEUS_EXPECTED_THROW(e) (throw(e))
#else
#define ZEUS_EXPECTED_THROW(e) ((void)(e), std::terminate())
#define ZEUS_EXPECTED_THROW(e) ((void) (e), std::terminate())
#endif

#define ZEUS_EXPECTED_ABI_TAG expected_abi
Expand Down Expand Up @@ -1222,6 +1222,7 @@ class expected
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<std::is_convertible_v<const U &, T> && std::is_convertible_v<const G &, E>> * = nullptr, //
expected_detail::enable_from_other_expected_t<T, E, U, G, const U &, const G &> * = nullptr>
constexpr expected(const expected<U, G> &rhs) //
Expand All @@ -1242,6 +1243,7 @@ class expected
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<!(std::is_convertible_v<const U &, T> && std::is_convertible_v<const G &, E>)> * = nullptr, //
expected_detail::enable_from_other_expected_t<T, E, U, G, const U &, const G &> * = nullptr>
constexpr explicit expected(const expected<U, G> &rhs) //
Expand All @@ -1262,6 +1264,7 @@ class expected
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<std::is_convertible_v<U, T> && std::is_convertible_v<G, E>> * = nullptr, //
expected_detail::enable_from_other_expected_t<T, E, U, G, U, G> * = nullptr>
constexpr expected(expected<U, G> &&rhs) //
Expand All @@ -1282,6 +1285,7 @@ class expected
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<!(std::is_convertible_v<U, T> && std::is_convertible_v<G, E>)> * = nullptr, //
expected_detail::enable_from_other_expected_t<T, E, U, G, U, G> * = nullptr>
constexpr explicit expected(expected<U, G> &&rhs) //
Expand Down Expand Up @@ -2173,6 +2177,7 @@ class expected<void, E>
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<std::is_convertible_v<const G &, E>> * = nullptr, //
expected_detail::enable_from_other_void_expected_t<E, U, G, const G &> * = nullptr>
constexpr expected(const expected<U, G> &rhs) //
Expand All @@ -2192,6 +2197,7 @@ class expected<void, E>
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<!std::is_convertible_v<const G &, E>> * = nullptr, //
expected_detail::enable_from_other_void_expected_t<E, U, G, const G &> * = nullptr>
constexpr explicit expected(const expected<U, G> &rhs) //
Expand All @@ -2211,6 +2217,7 @@ class expected<void, E>
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<std::is_convertible_v<G, E>> * = nullptr, //
expected_detail::enable_from_other_void_expected_t<E, U, G, G> * = nullptr>
constexpr expected(expected<U, G> &&rhs) //
Expand All @@ -2230,6 +2237,7 @@ class expected<void, E>
template<
class U, //
class G, //
std::enable_if_t<!std::is_same_v<expected<U, G>, expected>> * = nullptr, //
std::enable_if_t<!std::is_convertible_v<G, E>> * = nullptr, //
expected_detail::enable_from_other_void_expected_t<E, U, G, G> * = nullptr>
constexpr explicit expected(expected<U, G> &&rhs) //
Expand Down
Loading