diff --git a/include/boost/pfr/detail/core17_generated.hpp b/include/boost/pfr/detail/core17_generated.hpp index 5bd7e1b..3da674a 100644 --- a/include/boost/pfr/detail/core17_generated.hpp +++ b/include/boost/pfr/detail/core17_generated.hpp @@ -1024,6 +1024,12 @@ constexpr auto tie_as_tuple(T& val, size_t_<100>) noexcept { } +template +constexpr void tie_as_tuple(T& val, size_t_) noexcept { + static_assert(sizeof(T) && false, + "====================> Boost.PFR: Too many fields in a structure T. Regenerate include/boost/pfr/detail/core17_generated.hpp file for appropriate count of fields. For example: `python ./misc/generate_cpp17.py 300 > include/boost/pfr/detail/core17_generated.hpp`"); +} + }}} // namespace boost::pfr::detail #endif // BOOST_PFR_DETAIL_CORE17_GENERATED_HPP diff --git a/misc/generate_cpp17.py b/misc/generate_cpp17.py index 340f89c..4bd04f8 100644 --- a/misc/generate_cpp17.py +++ b/misc/generate_cpp17.py @@ -64,22 +64,18 @@ constexpr auto tie_as_tuple(T& val, size_t_<1>, std::enable_if_t +constexpr void tie_as_tuple(T& val, size_t_) noexcept { + static_assert(sizeof(T) && false, + "====================> Boost.PFR: Too many fields in a structure T. Regenerate include/boost/pfr/detail/core17_generated.hpp file for appropriate count of fields. For example: `python ./misc/generate_cpp17.py 300 > include/boost/pfr/detail/core17_generated.hpp`"); +} + }}} // namespace boost::pfr::detail #endif // BOOST_PFR_DETAIL_CORE17_GENERATED_HPP """ ############################################################################################################################ -generate_sfinae_attempts = False - - -if generate_sfinae_attempts: - print """ - template - constexpr auto tie_as_tuple(T& val, size_t_) noexcept { - return tie_as_tuple(val, size_t_{}); - } - """ indexes = " a" @@ -112,10 +108,4 @@ for i in xrange(1, funcs_count): print "}\n" - if generate_sfinae_attempts: - print "template " - print "constexpr auto tie_as_tuple(T& val, size_t_<" + str(i + 1) + "> v) noexcept" - print " ->decltype( ::boost::pfr::detail::tie_as_tuple0(std::forward(val), v) )" - print "{ return ::boost::pfr::detail::tie_as_tuple0(std::forward(val), v); }\n" - print EPILOGUE