@@ -99,18 +99,29 @@ namespace hud
9999 }
100100
101101 /* *
102- * Piecewise constructor.
103- * @tparam type_t Parameter pack for constructing.
104- * @tparam indexes Index sequence for elements to extract from the tuple.
105- * @param tuple_type Reference to the tuple to move from.
106- * @param ... Index sequences used to unpack the tuple elements.
102+ * Piecewise constructor forwarding a tuple of arguments.
103+ * @tparam Args Types of the elements in the tuple used for construction.
104+ * @param tuple Tuple of arguments to forward to the constructor of type_t.
107105 */
108- // template<typename tuple_type>
109- // constexpr tuple_leaf(hud::tag_piecewise_construct_t, tuple_type tuple) noexcept
110- // : content()
111- // {
112- // // static_assert(hud::is_nothrow_constructible_v<type_t, hud::get<indexes>(tuple)...>, "type_t(hud::get<indexes>(tuple)&&...) constructor is throwable. pair is not designed to allow throwable constructible components");
113- // }
106+ template <typename ... Args>
107+ constexpr tuple_leaf (hud::tag_piecewise_construct_t , hud::tuple<Args...> &&tuple) noexcept
108+ : tuple_leaf(hud::forward<hud::tuple<Args...>>(tuple), hud::make_index_sequence_for<Args...> {})
109+ {
110+ }
111+
112+ /* *
113+ * Piecewise constructor that unpacks a tuple into individual arguments.
114+ *
115+ * @tparam Args Types of the elements in the tuple used for construction.
116+ * @tparam indices Index sequence used to extract each element from the tuple.
117+ * @param tuple Tuple whose elements are forwarded to the constructor of type_t.
118+ */
119+ template <typename ... Args, usize... indices>
120+ constexpr tuple_leaf (hud::tuple<Args...> &&tuple, hud::index_sequence<indices...>) noexcept
121+ : content(hud::get<indices>(tuple)...)
122+ {
123+ static_assert (hud::is_nothrow_constructible_v<type_t , Args...>, " type_t(Args&&...) constructor is throwable. pair is not designed to allow throwable constructible components" );
124+ }
114125
115126 /* *
116127 * Assigns operator.
@@ -181,36 +192,16 @@ namespace hud
181192 {
182193 }
183194
184- // /**
185- // * Piecewise constructor for `tuple` using tuples of arguments to construct each tuple leafs.
186- // * This constructor forwards the elements of the tuples into the respective constructors.
187- // *
188- // * @param hud::tag_piecewise_construct_t Tag to indicate piecewise construction.
189- // * @param tuples Tuples containing arguments to forward to the constructor of each leafs.
190- // */
191- // template<typename... tuple_types>
192- // constexpr tuple_impl(hud::tag_piecewise_construct_t, tuple_types &&...tuples) noexcept
193- // : tuple_leaf<indices, types_t>(tuples..., hud::make_index_sequence<hud::tuple_size_v<tuples>...> {})...
194- // {
195- // }
196-
197- // template<typename... tuple_types>
198- // constexpr tuple_impl(hud::tag_piecewise_construct_t, tuple_type tuple) noexcept
199- // : tuple_leaf<indices, types_t>()
200- // {
201- // }
202-
203- // template<typename... types_t, typename... tuple_rest>
204- // constexpr tuple_impl(hud::tag_piecewise_construct_t, tuple_impl<types_t...> tuple, tuple_rest... rest) noexcept
205- // : tuple_leaf<indices, types_t>(tuple, hud::make_index_sequence_for<types_t...>)...
206- // {
207- // }
208-
209- // template<typename... types_t>
210- // constexpr tuple_impl(hud::tag_piecewise_construct_t, tuple_impl<types_t...> tuple) noexcept
211- // : tuple_leaf<indices, types_t>(tuple, hud::make_index_sequence_for<types_t...>)...
212- // {
213- // }
195+ /* *
196+ * Piecewise constructor for `tuple` using tuples of arguments to construct each tuple leafs.
197+ * @param hud::tag_piecewise_construct_t Tag to indicate piecewise construction.
198+ * @param tuples Tuples containing arguments to forward to the constructor of each leafs.
199+ */
200+ template <typename ... tuple_types>
201+ constexpr tuple_impl (hud::tag_piecewise_construct_t , tuple_types &&...tuples) noexcept
202+ : tuple_leaf<indices, types_t>(hud::tag_piecewise_construct, hud::forward<tuple_types>(tuples))...
203+ {
204+ }
214205
215206 /* * Copy constructor */
216207 constexpr tuple_impl (const tuple_impl &) = default;
@@ -661,18 +652,18 @@ namespace hud
661652 {
662653 }
663654
664- // / **
665- // * Piecewise constructor for `tuple` using tuples of arguments to construct each element.
666- // * This constructor forwards the elements of the tuples into the respective constructors.
667- // *
668- // * @param hud::tag_piecewise_construct_t Tag to indicate piecewise construction.
669- // * @param tuples Tuples containing arguments to forward to the constructor of each element.
670- // */
671- // template<typename... tuple_types>
672- // constexpr tuple(hud::tag_piecewise_construct_t, tuple_types &&...tuples) noexcept
673- // : super_type(hud::tag_piecewise_construct, tuples...)
674- // {
675- // }
655+ /* *
656+ * Piecewise constructor for `tuple` using tuples of arguments to construct each element.
657+ * This constructor forwards the elements of the tuples into the respective constructors.
658+ *
659+ * @param hud::tag_piecewise_construct_t Tag to indicate piecewise construction.
660+ * @param tuples Tuples containing arguments to forward to the constructor of each element.
661+ */
662+ template <typename ... tuple_types>
663+ constexpr tuple (hud::tag_piecewise_construct_t , tuple_types &&...tuples) noexcept
664+ : super_type(hud::tag_piecewise_construct, hud::forward<tuple_types>( tuples) ...)
665+ {
666+ }
676667
677668 /* *
678669 * Initialization copy constructor from a pair.
0 commit comments