Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-23 08:55:37

0001 // Copyright (c) 2018 Adam Butcher, Antony Polukhin
0002 // Copyright (c) 2019-2025 Antony Polukhin
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 #ifndef BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP
0008 #define BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP
0009 #pragma once
0010 
0011 #include <boost/pfr/detail/config.hpp>
0012 
0013 #include <boost/pfr/detail/core.hpp>
0014 
0015 #include <boost/pfr/detail/stdtuple.hpp>
0016 #include <boost/pfr/tuple_size.hpp>
0017 #include <boost/pfr/detail/make_integer_sequence.hpp>
0018 
0019 #ifdef BOOST_PFR_HAS_STD_MODULE
0020 import std;
0021 #else
0022 #include <tuple>
0023 #endif
0024 
0025 namespace boost { namespace pfr { namespace detail {
0026 
0027 /// \brief A `std::tuple` capable of de-structuring assignment used to support
0028 /// a tie of multiple lvalue references to fields of an aggregate T.
0029 ///
0030 /// \sa boost::pfr::tie_from_structure
0031 template <typename... Elements>
0032 struct tie_from_structure_tuple : std::tuple<Elements&...> {
0033     using base = std::tuple<Elements&...>;
0034     using base::base;
0035 
0036     template <typename T>
0037     constexpr tie_from_structure_tuple& operator= (T const& t) {
0038         base::operator=(
0039             detail::make_stdtiedtuple_from_tietuple(
0040                 detail::tie_as_tuple(t),
0041                 detail::make_index_sequence<tuple_size_v<T>>()));
0042         return *this;
0043     }
0044 };
0045 
0046 }}} // namespace boost::pfr::detail
0047 
0048 #endif // BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP