Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:38

0001 // Copyright (c) 2018 Adam Butcher, Antony Polukhin
0002 // Copyright (c) 2019-2023 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 #include <tuple>
0020 
0021 namespace boost { namespace pfr { namespace detail {
0022 
0023 /// \brief A `std::tuple` capable of de-structuring assignment used to support
0024 /// a tie of multiple lvalue references to fields of an aggregate T.
0025 ///
0026 /// \sa boost::pfr::tie_from_structure
0027 template <typename... Elements>
0028 struct tie_from_structure_tuple : std::tuple<Elements&...> {
0029     using base = std::tuple<Elements&...>;
0030     using base::base;
0031 
0032     template <typename T>
0033     constexpr tie_from_structure_tuple& operator= (T const& t) {
0034         base::operator=(
0035             detail::make_stdtiedtuple_from_tietuple(
0036                 detail::tie_as_tuple(t),
0037                 detail::make_index_sequence<tuple_size_v<T>>()));
0038         return *this;
0039     }
0040 };
0041 
0042 }}} // namespace boost::pfr::detail
0043 
0044 #endif // BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP