diff --git a/native/src/seal/util/iterator.h b/native/src/seal/util/iterator.h index 44821e55c..33b72e06f 100644 --- a/native/src/seal/util/iterator.h +++ b/native/src/seal/util/iterator.h @@ -1846,7 +1846,7 @@ namespace seal template IterTuple(const std::tuple &tp) : IterTuple(seal_apply( - [](auto &&... args) -> IterTuple { return { std::forward(args)... }; }, + [](auto &&... args) -> self_type { return self_type(std::forward(args)...); }, std::forward(tp))) { static_assert( @@ -1856,7 +1856,7 @@ namespace seal template IterTuple(std::tuple &&tp) : IterTuple(seal_apply( - [](auto &&... args) -> IterTuple && { return { std::forward(args)... }; }, + [](auto &&... args) -> self_type { return self_type(std::forward(args)...); }, std::forward(tp))) { static_assert( diff --git a/native/tests/seal/util/iterator.cpp b/native/tests/seal/util/iterator.cpp index 9d96eb6b5..f4cf7c135 100644 --- a/native/tests/seal/util/iterator.cpp +++ b/native/tests/seal/util/iterator.cpp @@ -474,6 +474,15 @@ namespace sealtest ASSERT_EQ(1, *get<0>(s)); ASSERT_EQ(0, *get<1>(s)); + auto tuple_source = make_tuple(2, 3); + IterTuple, SeqIter> from_tuple(tuple_source); + ASSERT_EQ(2, *get<0>(from_tuple)); + ASSERT_EQ(3, *get<1>(from_tuple)); + + IterTuple, SeqIter> from_moved_tuple(make_tuple(4, 5)); + ASSERT_EQ(4, *get<0>(from_moved_tuple)); + ASSERT_EQ(5, *get<1>(from_moved_tuple)); + // Get ASSERT_EQ(0, get<0>(IterTuple, SeqIter>{ 0, 1 })); ASSERT_EQ(1, get<1>(IterTuple, SeqIter>{ 0, 1 }));