optimize lazy collectAll implement
Search before asking
- [ ] I searched the issues and found no similar issues.
What happened + What you expected to happen
https://github.com/alibaba/async_simple/blob/ab70389831cb2b9be060fd66c913833c000843fc/async_simple/coro/Collect.h#L229
Lazy<> foo() {}
collectAll(foo().via(executor)) is equal to collectAllPara(foo())
maybe we can use collectAll(foo().via(executor)) to simplify the collectAllPara, for example: collectAllPara call collectAll(foo().via(executor)) directly
Reproduction way
Anything else
Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
What if the lazy don't contain an Executor when we call collectAllPara(foo())?
What if the lazy don't contain an Executor when we call collectAllPara(foo())?
collectAllPara can not run sub coroutines in parallel without executor
Another problem is that collectAllPara is not equal to collectAll, it might be design mistake. We may need to change it.
Another problem is that
collectAllParais not equal tocollectAll, it might be design mistake. We may need to change it.
em,we can remove
using AT = std::conditional_t<
std::is_same_v<LazyType<T>, Lazy<T>>,
detail::SimpleCollectAllAwaitable<T, IAlloc, OAlloc, Para>,
detail::CollectAllAwaiter<LazyType<T>, IAlloc, OAlloc, Para>>;
Another problem is that
collectAllParais not equal tocollectAll, it might be design mistake. We may need to change it.em,we can remove
using AT = std::conditional_t< std::is_same_v<LazyType<T>, Lazy<T>>, detail::SimpleCollectAllAwaitable<T, IAlloc, OAlloc, Para>, detail::CollectAllAwaiter<LazyType<T>, IAlloc, OAlloc, Para>>;
Maybe we need to do more work on the interface. The previous design looks not good.