Skip to content

Commit

Permalink
Fix for old MSVC compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
denzor200 committed Sep 10, 2023
1 parent 8794056 commit 6dcf66c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
17 changes: 3 additions & 14 deletions include/boost/pfr/core_name.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <boost/pfr/detail/make_integer_sequence.hpp>

#include <cstddef> // for std::size_t
#include <type_traits> // for std::enable_if_t

#include <boost/pfr/tuple_size.hpp>

Expand Down Expand Up @@ -75,24 +74,14 @@ std::array<std::string_view, boost::pfr::tuple_size_v<T>>
#else
auto
#endif
names_as_array(
#ifndef BOOST_PFR_DOXYGEN_INVOKED
std::enable_if_t<!decltype(detail::tie_as_names_tuple<T>())::empty()>* = nullptr
#endif
) noexcept {
names_as_array() noexcept {
return detail::make_stdarray_from_tietuple(
detail::tie_as_names_tuple<T>(),
detail::make_index_sequence< tuple_size_v<T> >()
detail::make_index_sequence< tuple_size_v<T> >(),
1L
);
}

#ifndef BOOST_PFR_DOXYGEN_INVOKED
template <class T>
constexpr auto names_as_array(std::enable_if_t<decltype(detail::tie_as_names_tuple<T>())::empty()>* = nullptr) noexcept {
return detail::make_empty_stdarray();
}
#endif

}} // namespace boost::pfr

#endif // BOOST_PFR_CORE_NAME_HPP
Expand Down
5 changes: 3 additions & 2 deletions include/boost/pfr/detail/stdarray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ constexpr auto make_stdarray(const Types&... t) noexcept {
}

template <class T, std::size_t... I>
constexpr auto make_stdarray_from_tietuple(const T& t, std::index_sequence<I...>) noexcept {
constexpr auto make_stdarray_from_tietuple(const T& t, std::index_sequence<I...>, int) noexcept {
return detail::make_stdarray(
boost::pfr::detail::sequence_tuple::get<I>(t)...
);
}

constexpr auto make_empty_stdarray() noexcept {
template <class T>
constexpr auto make_stdarray_from_tietuple(const T& t, std::index_sequence<>, long) noexcept {
return std::array<std::nullptr_t, 0>{};
}

Expand Down

0 comments on commit 6dcf66c

Please sign in to comment.