Skip to content

Commit

Permalink
Address MSVC issue
Browse files Browse the repository at this point in the history
  • Loading branch information
runer112 committed Sep 20, 2024
1 parent f980a51 commit 09ef2fb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/boost/pfr/detail/fields_count.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,13 @@ constexpr std::size_t fields_count_binary_search(detail::multi_element_range, in
return detail::fields_count_binary_search<T, Begin, next_v>(detail::is_one_element_range<Begin, next_v>{}, 1L);
}

template <class T, std::size_t Begin, std::size_t I = 1>
constexpr std::size_t fields_count_upper_bound(int, int) noexcept {
template <class T, std::size_t Begin, std::size_t I>
constexpr std::size_t fields_count_upper_bound(int, int) noexcept
{
return Begin + I - 1;
}

template <class T, std::size_t Begin, std::size_t I = 1>
template <class T, std::size_t Begin, std::size_t I>
constexpr auto fields_count_upper_bound(long, long) noexcept
-> std::enable_if_t<(Begin + I > fields_count_upper_bound_loose<T>()), std::size_t>
{
Expand All @@ -243,7 +244,7 @@ constexpr auto fields_count_upper_bound(long, long) noexcept
return fields_count_upper_bound_loose<T>();
}

template <class T, std::size_t Begin, std::size_t I = 1>
template <class T, std::size_t Begin, std::size_t I>
constexpr auto fields_count_upper_bound(long, int) noexcept
-> detail::enable_if_constructible_helper_t<T, Begin + I>
{
Expand All @@ -253,7 +254,7 @@ constexpr auto fields_count_upper_bound(long, int) noexcept
template <class T, std::size_t Begin = 0>
constexpr std::size_t fields_count_binary_search_unbounded() noexcept
{
constexpr std::size_t last = detail::fields_count_upper_bound<T, Begin>(1L, 1L);
constexpr std::size_t last = detail::fields_count_upper_bound<T, Begin, 1>(1L, 1L);
constexpr std::size_t middle = (Begin + last + 1) / 2;
return detail::fields_count_binary_search<T, Begin, middle>(detail::is_one_element_range<Begin, middle>{}, 1L);
}
Expand Down

0 comments on commit 09ef2fb

Please sign in to comment.