2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-19 04:22:13 +00:00

Fix for old MSVC compiler

This commit is contained in:
denzor200
2023-09-10 05:19:20 +03:00
parent 8794056e20
commit 6dcf66cbd5
2 changed files with 6 additions and 16 deletions

View File

@@ -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>
@@ -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

View File

@@ -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>{};
}