// Copyright (c) 2025-2026 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Initial implementation by Bela Schaum, https://github.com/schaumb // The way to make it union and UB free by X-Ryl669, https://github.com/X-Ryl669 // #ifndef BOOST_PFR_DETAIL_CORE_NAME26_REFLECTION_HPP #define BOOST_PFR_DETAIL_CORE_NAME26_REFLECTION_HPP #pragma once #include #include #include #include #include #if !defined(BOOST_PFR_INTERFACE_UNIT) #include #include #include // for std::addressof #include #endif namespace boost { namespace pfr { namespace detail { template constexpr std::string_view get_name() 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." ); static_assert( !std::is_array::value, "====================> Boost.PFR: It is impossible to extract name from old C array since it doesn't have named members" ); return identifier_of( nonstatic_data_members_of( ^^T, std::meta::access_context::current() ).at(I) ); } template constexpr auto tie_as_names_tuple_impl(std::index_sequence) noexcept { return detail::sequence_tuple::make_sequence_tuple(detail::get_name()...); } template constexpr auto tie_as_names_tuple() noexcept { return detail::tie_as_names_tuple_impl(detail::make_index_sequence()>{}); } }}} // namespace boost::pfr::detail #endif // BOOST_PFR_DETAIL_CORE_NAME20_STATIC_HPP