Skip to content

Commit

Permalink
Merge #5846
Browse files Browse the repository at this point in the history
5846: [execution] Add schedule_result_t alias template. r=hkaiser a=SAtacker

- Alias schedule_result_t gives the result type of schedule

Signed-off-by: Shreyas Atre <shreyasatre16@gmail.com>


## Any background context you want to provide?

- #5045 (comment)
- [X] I have added a new feature and have added tests to go along with it.
- [ ] I have fixed a bug and have added a regression test.
- [ ] I have added a test using random numbers; I have made sure it uses a seed, and that the random numbers generated are valid inputs for the tests.


Co-authored-by: Shreyas Atre <shreyasatre16@gmail.com>
  • Loading branch information
StellarBot and SAtacker committed May 26, 2022
2 parents 3589799 + 62479f3 commit 25248a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ namespace hpx { namespace execution { namespace experimental {
template <typename Scheduler>
inline constexpr bool is_scheduler_v = is_scheduler<Scheduler>::value;

template <typename S>
using schedule_result_t = hpx::util::invoke_result_t<schedule_t, S>;

template <typename S, typename R>
using connect_result_t = hpx::util::invoke_result_t<connect_t, S, R>;
}}} // namespace hpx::execution::experimental
11 changes: 11 additions & 0 deletions libs/core/execution_base/tests/unit/basic_schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,16 @@ int main()
HPX_TEST_EQ(friend_tag_invoke_schedule_calls, std::size_t(1));
HPX_TEST_EQ(tag_invoke_schedule_calls, std::size_t(1));

static_assert(
std::is_same_v<
hpx::execution::experimental::schedule_result_t<scheduler_1>,
sender>,
"Result of scheduler is a sender");
static_assert(
std::is_same_v<
hpx::execution::experimental::schedule_result_t<scheduler_2>,
sender>,
"Result of scheduler is a sender");

return hpx::util::report_errors();
}

0 comments on commit 25248a1

Please sign in to comment.