You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: interface/core/containers/pair.h
+31-7Lines changed: 31 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -104,18 +104,24 @@ namespace hud
104
104
static_assert(hud::is_nothrow_move_constructible_v<second_type, v_type_t>, "second_type(v_type_t&&) move constructor is throwable. pair is not designed to allow throwable move constructible components");
105
105
}
106
106
107
+
/**
108
+
* Piecewise constructor for `pair` using two tuples of arguments to construct each element.
109
+
* This constructor forwards the elements of the two tuples into the respective constructors of `first` and `second`.
110
+
* Internally, it uses index sequences to unpack the tuple elements and delegates to the other constructor.
111
+
*
112
+
* @tparam u_type_t Parameter pack for constructing the `first_type`.
113
+
* @tparam v_type_t Parameter pack for constructing the `second_type`.
114
+
* @param hud::tag_piecewise_construct_t Tag to indicate piecewise construction.
115
+
* @param first_tuple Tuple containing arguments to forward to the constructor of `first`.
116
+
* @param second_tuple Tuple containing arguments to forward to the constructor of `second`.
static_assert(hud::is_nothrow_constructible_v<first_type, u_type_t...>, "first_type(u_type_t&&...) constructor is throwable. pair is not designed to allow throwable constructible components");
124
+
static_assert(hud::is_nothrow_constructible_v<second_type, v_type_t...>, "second_type(v_type_t&&...) constructor is throwable. pair is not designed to allow throwable constructible components");
119
125
}
120
126
121
127
/**
@@ -268,6 +274,24 @@ namespace hud
268
274
hud::swap(first, other.first);
269
275
hud::swap(second, other.second);
270
276
}
277
+
278
+
private:
279
+
/**
280
+
* Constructs a `pair` from two tuples by unpacking their elements.
281
+
* @tparam tuple_first Type of the first tuple.
282
+
* @tparam tuple_second Type of the second tuple.
283
+
* @tparam indexes_first Index sequence for elements to extract from the first tuple.
284
+
* @tparam indexes_second Index sequence for elements to extract from the second tuple.
285
+
* @param first_tuple Reference to the first tuple to move from.
286
+
* @param second_tuple Reference to the second tuple to move from.
287
+
* @param ... Index sequences used to unpack the tuple elements.
0 commit comments