-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d90c6d8
commit 96b5f8b
Showing
4 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// include/Beman/Execution26/detail/default_impls.hpp -*-C++-*- | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_DEFAULT_IMPLS | ||
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_DEFAULT_IMPLS | ||
|
||
#include <Beman/Execution26/detail/fwd_env.hpp> | ||
#include <Beman/Execution26/detail/get_env.hpp> | ||
#include <Beman/Execution26/detail/empty_env.hpp> | ||
#include <Beman/Execution26/detail/start.hpp> | ||
#include <Beman/Execution26/detail/sender_decompose.hpp> | ||
#include <Beman/Execution26/detail/callable.hpp> | ||
#include <utility> | ||
#include <type_traits> | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
namespace Beman::Execution26::Detail | ||
{ | ||
struct default_impls | ||
{ | ||
static constexpr auto get_attrs | ||
= [](auto const&, auto const&... child) noexcept -> decltype(auto) | ||
{ | ||
if constexpr (1 == sizeof...(child)) | ||
return (::Beman::Execution26::Detail::fwd_env( | ||
::Beman::Execution26::get_env(child) | ||
), ...); | ||
else | ||
return ::Beman::Execution26::empty_env{}; | ||
}; | ||
static constexpr auto get_env | ||
= [](auto, auto&, auto const& receiver) noexcept -> decltype(auto) | ||
{ | ||
return ::Beman::Execution26::Detail::fwd_env( | ||
::Beman::Execution26::get_env(receiver) | ||
); | ||
}; | ||
static constexpr auto get_state | ||
= []<typename Sender, typename Receiver>(Sender&& sender, Receiver&) noexcept -> decltype(auto) | ||
{ | ||
auto&& decompose = ::Beman::Execution26::Detail::get_sender_data(::std::forward<Sender>(sender)); | ||
return ::std::forward_like<Sender>(decompose.data); | ||
}; | ||
static constexpr auto start | ||
= [](auto&, auto&, auto&... ops) noexcept -> void | ||
{ | ||
(::Beman::Execution26::start(ops), ...); | ||
}; | ||
static constexpr auto complete | ||
= []<typename Index, typename Receiver, typename Tag, typename... Args>( | ||
Index, auto&, Receiver& receiver, Tag, Args&&... args) noexcept -> void | ||
requires ::Beman::Execution26::Detail::callable<Tag, Receiver, Args...> | ||
{ | ||
static_assert(Index::value == 0); | ||
Tag()(::std::move(receiver), ::std::forward<Args>(args)...); | ||
}; | ||
}; | ||
} | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters