Skip to content

Commit

Permalink
🐛 std::variant should be properly gated...
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Mar 14, 2021
1 parent f541383 commit f56b3c6
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions include/sol/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,21 +479,39 @@ namespace sol { namespace meta {
template <typename T, typename U>
class supports_op_less_test<T, U, void_t<decltype(std::declval<T&>() < std::declval<U&>())>>
: public std::integral_constant<bool,
!is_specialization_of_v<unqualified_t<T>, std::variant> && !is_specialization_of_v<unqualified_t<U>, std::variant>> { };
#if SOL_IS_ON(SOL_STD_VARIANT_I_)
!is_specialization_of_v<unqualified_t<T>, std::variant> && !is_specialization_of_v<unqualified_t<U>, std::variant>
#else
true
#endif
> {
};

template <typename T, typename U, typename = void>
class supports_op_equal_test : public std::false_type { };
template <typename T, typename U>
class supports_op_equal_test<T, U, void_t<decltype(std::declval<T&>() == std::declval<U&>())>>
: public std::integral_constant<bool,
!is_specialization_of_v<unqualified_t<T>, std::variant> && !is_specialization_of_v<unqualified_t<U>, std::variant>> { };
#if SOL_IS_ON(SOL_STD_VARIANT_I_)
!is_specialization_of_v<unqualified_t<T>, std::variant> && !is_specialization_of_v<unqualified_t<U>, std::variant>
#else
true
#endif
> {
};

template <typename T, typename U, typename = void>
class supports_op_less_equal_test : public std::false_type { };
template <typename T, typename U>
class supports_op_less_equal_test<T, U, void_t<decltype(std::declval<T&>() <= std::declval<U&>())>>
: public std::integral_constant<bool,
!is_specialization_of_v<unqualified_t<T>, std::variant> && !is_specialization_of_v<unqualified_t<U>, std::variant>> { };
#if SOL_IS_ON(SOL_STD_VARIANT_I_)
!is_specialization_of_v<unqualified_t<T>, std::variant> && !is_specialization_of_v<unqualified_t<U>, std::variant>
#else
true
#endif
> {
};

template <typename T, typename U, typename = void>
class supports_op_left_shift_test : public std::false_type { };
Expand Down

0 comments on commit f56b3c6

Please sign in to comment.