Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions native/src/seal/util/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ namespace seal
template <typename... Ts>
IterTuple(const std::tuple<Ts...> &tp)
: IterTuple(seal_apply(
[](auto &&... args) -> IterTuple { return { std::forward<decltype(args)>(args)... }; },
[](auto &&... args) -> self_type { return self_type(std::forward<decltype(args)>(args)...); },
std::forward<decltype(tp)>(tp)))
{
static_assert(
Expand All @@ -1856,7 +1856,7 @@ namespace seal
template <typename... Ts>
IterTuple(std::tuple<Ts...> &&tp)
: IterTuple(seal_apply(
[](auto &&... args) -> IterTuple && { return { std::forward<decltype(args)>(args)... }; },
[](auto &&... args) -> self_type { return self_type(std::forward<decltype(args)>(args)...); },
std::forward<decltype(tp)>(tp)))
{
static_assert(
Expand Down
9 changes: 9 additions & 0 deletions native/tests/seal/util/iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>, SeqIter<int>> from_tuple(tuple_source);
ASSERT_EQ(2, *get<0>(from_tuple));
ASSERT_EQ(3, *get<1>(from_tuple));

IterTuple<SeqIter<int>, SeqIter<int>> 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<int>, SeqIter<int>>{ 0, 1 }));
ASSERT_EQ(1, get<1>(IterTuple<SeqIter<int>, SeqIter<int>>{ 0, 1 }));
Expand Down
Loading