<commit_before>#ifndef EE_X_WHEN_ALL_HPP
#define EE_X_WHEN_ALL_HPP

#ifdef __cplusplus

#include <vector>

#include "ee/core/LambdaAwaiter.hpp"
#include "ee/core/NoAwait.hpp"
#include "ee/core/Task.hpp"

namespace ee {
namespace core {
namespace detail {
template <class T>
Task<> toVoidTask(T&& task) {
    co_await task;
    co_return;
}
} // namespace detail

template <class... Args>
Task<> whenAll(Args&&... args) {
    std::vector<Task<>> tasks = {
        detail::toVoidTask(std::forward<Args>(args))...};
    auto counter = std::make_shared<std::size_t>(tasks.size());
    co_await LambdaAwaiter<>([&tasks, counter](auto&& resolve) { //
        for (auto&& task : tasks) {
            noAwait([&task, counter, resolve]() -> Task<> {
                co_await task;
                --(*counter);
                if (*counter == 0) {
                    resolve();
                }
            });
        }
    });
    co_return;
}
} // namespace core
} // namespace ee

#endif // __cplusplus

#endif // EE_X_WHEN_ALL_HPP<commit_msg>Alias ee::core::whenAll to ee::whenAll.<commit_after>#ifndef EE_X_WHEN_ALL_HPP
#define EE_X_WHEN_ALL_HPP

#ifdef __cplusplus

#include <vector>

#include "ee/core/LambdaAwaiter.hpp"
#include "ee/core/NoAwait.hpp"
#include "ee/core/Task.hpp"

namespace ee {
namespace core {
namespace detail {
template <class T>
Task<> toVoidTask(T&& task) {
    co_await task;
    co_return;
}
} // namespace detail

template <class... Args>
Task<> whenAll(Args&&... args) {
    std::vector<Task<>> tasks = {
        detail::toVoidTask(std::forward<Args>(args))...};
    auto counter = std::make_shared<std::size_t>(tasks.size());
    co_await LambdaAwaiter<>([&tasks, counter](auto&& resolve) { //
        for (auto&& task : tasks) {
            noAwait([&task, counter, resolve]() -> Task<> {
                co_await task;
                --(*counter);
                if (*counter == 0) {
                    resolve();
                }
            });
        }
    });
    co_return;
}
} // namespace core

using core::whenAll;
} // namespace ee

#endif // __cplusplus

#endif // EE_X_WHEN_ALL_HPP
{'fraction_non_alphanumeric': 0.16165413533834586, 'fraction_numerical': 0.0009398496240601503, 'mean_word_length': 2.4901639344262296, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2937700', 'n_tokens_mistral': 738, 'n_tokens_neox': 727, 'n_words': 146}