Skip to content

Commit

Permalink
fix(co): more typename before dependent type
Browse files Browse the repository at this point in the history
  • Loading branch information
Codesire-Deng committed Dec 28, 2023
1 parent 06dce1f commit 0e98d91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions include/co_context/co/when_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ template<mpl::TL out_type_list>
struct all_meta : all_meta_base {
static_assert(mpl::count_v<out_type_list, void> == 0);

using value_type = out_type_list::template to<std::tuple>;
using value_type = typename out_type_list::template to<std::tuple>;
using buffer_type =
mpl::map_t<out_type_list, detail::uninitialize>::template to<
typename mpl::map_t<out_type_list, detail::uninitialize>::template to<
std::tuple>;

buffer_type buffer;
Expand Down Expand Up @@ -91,7 +91,7 @@ struct all_trait {
public:
using meta_type = all_meta<out_type_list>;

using value_type = meta_type::value_type;
using value_type = typename meta_type::value_type;

template<size_t idx>
static constexpr size_t buffer_offset_v =
Expand Down Expand Up @@ -142,7 +142,7 @@ all(task_types... node) {

using trait = detail::all_trait<task_types...>;

using all_meta_type = trait::meta_type;
using all_meta_type = typename trait::meta_type;

all_meta_type meta{co_await lazy::who_am_i(), n};

Expand Down
13 changes: 7 additions & 6 deletions include/co_context/co/when_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ struct any_trait {
using in_type_list = mpl::type_list<typename task_types::value_type...>;

using out_type_list =
mpl::remove_t<in_type_list, void>::template prepend<std::monostate>;
typename mpl::remove_t<in_type_list, void>::template prepend<
std::monostate>;

using variant_type = out_type_list::template to<std::variant>;
using variant_type = typename out_type_list::template to<std::variant>;

public:
static constexpr bool is_all_void =
Expand Down Expand Up @@ -152,7 +153,7 @@ any(task_types... node) {
static_assert(n >= 2, "too few tasks for `any(...)`");

using trait = detail::any_trait<task_types...>;
using meta_type = trait::meta_type;
using meta_type = typename trait::meta_type;
auto meta_ptr = std::make_shared<meta_type>(co_await lazy::who_am_i());

auto spawn_all = [&]<size_t... idx>(std::index_sequence<idx...>) {
Expand All @@ -177,7 +178,7 @@ any(task_types... node) {
if constexpr (trait::is_all_void) {
co_return meta_ptr->idx;
} else {
using value_type = trait::value_type;
using value_type = typename trait::value_type;
co_return value_type{meta_ptr->idx, std::move(meta_ptr->buffer)};
}
}
Expand Down Expand Up @@ -240,7 +241,7 @@ struct some_trait {
private:
using in_type_list = mpl::type_list<typename task_types::value_type...>;

using element_type = any_trait<task_types...>::value_type;
using element_type = typename any_trait<task_types...>::value_type;

public:
using value_type = std::vector<element_type>;
Expand Down Expand Up @@ -300,7 +301,7 @@ some(uint32_t min_complete, task_types... node) {
assert(min_complete >= 1 && "min_complete should be at least 1");

using trait = detail::some_trait<task_types...>;
using meta_type = trait::meta_type;
using meta_type = typename trait::meta_type;
auto meta_ptr =
std::make_shared<meta_type>(co_await lazy::who_am_i(), min_complete);

Expand Down

0 comments on commit 0e98d91

Please sign in to comment.