Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Sep 18, 2023
1 parent 71b14e6 commit 05733cf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/ylt/struct_pack/reflection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,21 @@ struct constant_checker{};
template <typename T, typename = void>
struct has_user_defined_id_ADL_impl : std::false_type {};

#ifdef _MSC_VER
// FIXME: we can't check if it's compile-time calculated in msvc with C++17
template <typename T>
struct has_user_defined_id_ADL_impl<
T, std::void_t<decltype(struct_pack_id((T*)nullptr))>>
: std::true_type {};
#else

template <typename T>
struct has_user_defined_id_ADL_impl<
T, std::void_t<constant_checker<struct_pack_id((T*)nullptr)>>>
: std::true_type {};

#endif

template <typename T>
constexpr bool has_user_defined_id_ADL = has_user_defined_id_ADL_impl<T>::value;

Expand Down

0 comments on commit 05733cf

Please sign in to comment.