Skip to content

Commit d15b071

Browse files
author
Julian LALU
committed
Add tuple piecewise_construct
1 parent 923b458 commit d15b071

File tree

3 files changed

+590
-5
lines changed

3 files changed

+590
-5
lines changed

interface/core/containers/tuple.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ namespace hud
118118
*/
119119
template<typename... Args, usize... indices>
120120
constexpr tuple_leaf(hud::tuple<Args...> &&tuple, hud::index_sequence<indices...>) noexcept
121-
: content(hud::get<indices>(tuple)...)
121+
: content(hud::forward<Args>(hud::get<indices>(tuple))...)
122122
{
123123
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");
124124
}

test/pair/pair_constructors.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,17 +1606,15 @@ GTEST_TEST(pair, piecewise_constructor_non_trivial_type_same_type)
16061606
const auto test = []()
16071607
{
16081608
using type = hud_test::non_bitwise_type;
1609-
const type to_copy_0;
1610-
const type to_copy_1;
16111609
hud::pair<type, type> pair {hud::tag_piecewise_construct, hud::forward_as_tuple(1, nullptr), hud::forward_as_tuple(2, nullptr)};
16121610
return std::tuple {
1613-
hud::get<0>(pair).id(), // 0
1611+
hud::get<0>(pair).id() == 1, // 0
16141612
hud::get<0>(pair).constructor_count() == 1, // 1
16151613
hud::get<0>(pair).copy_constructor_count() == 0, // 2
16161614
hud::get<0>(pair).move_constructor_count() == 0, // 3
16171615
hud::get<0>(pair).copy_assign_count() == 0, // 4
16181616
hud::get<0>(pair).move_assign_count() == 0, // 5
1619-
hud::get<1>(pair).id(), // 6
1617+
hud::get<1>(pair).id() == 2, // 6
16201618
hud::get<1>(pair).constructor_count() == 1, // 7
16211619
hud::get<1>(pair).copy_constructor_count() == 0, // 8
16221620
hud::get<1>(pair).move_constructor_count() == 0, // 9

0 commit comments

Comments
 (0)