Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-17 08:52:49

0001 // Copyright (c) 2016-2025 Antony Polukhin
0002 // Copyright (c) 2025 Jean-Michaƫl Celerier
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // boost-no-inspect
0008 
0009 #ifndef BOOST_PFR_DETAIL_CORE26_HPP
0010 #define BOOST_PFR_DETAIL_CORE26_HPP
0011 #pragma once
0012 
0013 #include <boost/pfr/detail/sequence_tuple.hpp>
0014 
0015 namespace boost::pfr::detail {
0016 
0017 template<class T>
0018 constexpr auto tie_as_tuple(T &val) noexcept {
0019     static_assert(!std::is_union<T>::value,
0020                   "====================> Boost.PFR: For safety reasons it is forbidden to reflect "
0021                   "unions. See `Reflection of unions` section in the docs for more info.");
0022     auto &&[... members] = std::forward<T>(val);
0023     return sequence_tuple::tuple<std::add_lvalue_reference_t<decltype(members)>...>{members...};
0024 }
0025 
0026 template <class T, class F, std::size_t... I>
0027 constexpr void for_each_field_dispatcher(T& t, F&& f, std::index_sequence<I...>) {
0028     static_assert(
0029         !std::is_union<T>::value,
0030         "====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. See `Reflection of unions` section in the docs for more info."
0031     );
0032     std::forward<F>(f)(
0033         detail::tie_as_tuple(t)
0034     );
0035 }
0036 
0037 } // namespace boost::pfr::detail
0038 
0039 #endif