diff --git a/include/boost/pfr/detail/core17.hpp b/include/boost/pfr/detail/core17.hpp index d3827c2..a182d70 100644 --- a/include/boost/pfr/detail/core17.hpp +++ b/include/boost/pfr/detail/core17.hpp @@ -44,6 +44,16 @@ static_assert( ); #endif // #ifndef _MSC_VER +template +constexpr auto tie_as_tuple(T& val) noexcept { + static_assert( + !std::is_union::value, + "====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. See `Reflection of unions` section in the docs for more info." + ); + typedef size_t_()> fields_count_tag; + return boost::pfr::detail::tie_as_tuple(val, fields_count_tag{}); +} + template void for_each_field_dispatcher(T& t, F&& f, std::index_sequence) { static_assert( diff --git a/include/boost/pfr/detail/core17_generated.hpp b/include/boost/pfr/detail/core17_generated.hpp index 742bf66..6638ce2 100644 --- a/include/boost/pfr/detail/core17_generated.hpp +++ b/include/boost/pfr/detail/core17_generated.hpp @@ -14,13 +14,12 @@ #pragma once #include -#include - #if !BOOST_PFR_USE_CPP17 # error C++17 is required for this header. #endif #include +#include #include namespace boost { namespace pfr { namespace detail { @@ -1026,18 +1025,6 @@ constexpr auto tie_as_tuple(T& val, size_t_<100>) noexcept { } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -template -constexpr auto tie_as_tuple(T& val) noexcept { - static_assert( - !std::is_union::value, - "====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. See `Reflection of unions` section in the docs for more info." - ); - typedef size_t_()> fields_count_tag; - return boost::pfr::detail::tie_as_tuple(val, fields_count_tag{}); -} - }}} // namespace boost::pfr::detail #endif // BOOST_PFR_DETAIL_CORE17_GENERATED_HPP diff --git a/misc/generate_cpp17.py b/misc/generate_cpp17.py index aaaf59d..ae4dc75 100644 --- a/misc/generate_cpp17.py +++ b/misc/generate_cpp17.py @@ -29,13 +29,12 @@ PROLOGUE = """// Copyright (c) 2016-2020 Antony Polukhin #pragma once #include -#include - #if !BOOST_PFR_USE_CPP17 # error C++17 is required for this header. #endif #include +#include #include namespace boost { namespace pfr { namespace detail { @@ -66,18 +65,6 @@ constexpr auto tie_as_tuple(T& val, size_t_<1>, std::enable_if_t -constexpr auto tie_as_tuple(T& val) noexcept { - static_assert( - !std::is_union::value, - "====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. See `Reflection of unions` section in the docs for more info." - ); - typedef size_t_()> fields_count_tag; - return boost::pfr::detail::tie_as_tuple(val, fields_count_tag{}); -} - }}} // namespace boost::pfr::detail #endif // BOOST_PFR_DETAIL_CORE17_GENERATED_HPP