Skip to content

Commit

Permalink
fix collectAllPara dont use SimpleCollectAllVariadicAwaiter (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle authored Nov 5, 2024
1 parent 866cc3a commit 3cceedc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ docs/.vitepress/cache
docs/public
node_modules
compile_commands.json
modules_test/_deps

# Ignore Bzlmod lock file until it is more stable
MODULE.bazel.lock
2 changes: 1 addition & 1 deletion async_simple/coro/Collect.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ template <bool Para, template <typename> typename LazyType, typename... Ts>
inline auto collectAllVariadicImpl(LazyType<Ts>&&... awaitables) {
static_assert(sizeof...(Ts) > 0);
using AT = std::conditional_t<
is_lazy<LazyType<void>>::value && !Para,
is_lazy<LazyType<void>>::value,
SimpleCollectAllVariadicAwaiter<Para, LazyType, Ts...>,
CollectAllVariadicAwaiter<Para, LazyType, Ts...>>;
return AT(std::move(awaitables)...);
Expand Down
2 changes: 0 additions & 2 deletions async_simple/coro/test/LazyTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,14 +1074,12 @@ TEST_F(LazyTest, testCollectAllVariadic) {
co_return std::this_thread::get_id();
};

auto id = std::this_thread::get_id();
CHECK_EXECUTOR(&e1);
auto out_tuple = co_await collectAllPara(
std::move(intLazy), std::move(doubleLazy), std::move(stringLazy),
sleepLazy(2), sleepLazy(1));
CHECK_EXECUTOR(&e1);

EXPECT_EQ(std::this_thread::get_id(), id);
EXPECT_EQ(5u, std::tuple_size<decltype(out_tuple)>::value);

auto [v_try_int, v_try_double, v_try_string, id0, id1] =
Expand Down

0 comments on commit 3cceedc

Please sign in to comment.