1 // Copyright (c) 2018 Adam Butcher, Antony Polukhin
2 // Copyright (c) 2019-2022 Antony Polukhin
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP
8 #define BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP
11 #include <boost/pfr/detail/config.hpp>
13 #include <boost/pfr/detail/core.hpp>
15 #include <boost/pfr/detail/stdtuple.hpp>
16 #include <boost/pfr/tuple_size.hpp>
17 #include <boost/pfr/detail/make_integer_sequence.hpp>
21 namespace boost { namespace pfr { namespace detail {
23 /// \brief A `std::tuple` capable of de-structuring assignment used to support
24 /// a tie of multiple lvalue references to fields of an aggregate T.
26 /// \sa boost::pfr::tie_from_structure
27 template <typename... Elements>
28 struct tie_from_structure_tuple : std::tuple<Elements&...> {
29 using base = std::tuple<Elements&...>;
33 constexpr tie_from_structure_tuple& operator= (T const& t) {
35 detail::make_stdtiedtuple_from_tietuple(
36 detail::tie_as_tuple(t),
37 detail::make_index_sequence<tuple_size_v<T>>()));
42 }}} // namespace boost::pfr::detail
44 #endif // BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP