Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the TODO (primarily to create a PR) #1

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ e.g.:

| Library | Linux | MacOS | Windows |
| ------- | ----- | ----- | ------- |
| build | ![Linux build status](https://github.com/dietmarkuehl/beman-execution/actions/workflows/linux.yml/badge.svg) | ![MacOS build status](https://github.com/dietmarkuehl/beman-execution/actions/workflows/macos.yml/badge.svg) | ![Window build status](https://github.com/dietmarkuehl/beman-execution/actions/workflows/windows.yml/badge.svg) |
| build | ![Linux build status](https://github.com/beman-project/Execution26/actions/workflows/linux.yml/badge.svg) | ![MacOS build status](https://github.com/beman-project/Execution26/actions/workflows/macos.yml/badge.svg) | ![Window build status](https://github.com/beman-project/Execution26/actions/workflows/windows.yml/badge.svg) |

You can just use `make` in the current directory. It will invoke `cmake`,
build the code, and run tests. To have more control over the build-process
Expand Down
1 change: 1 addition & 0 deletions docs/TODO.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"execution.queries": { "code":true, "test":true, "doc":true, "comment":"empty" },
"execution.queryable": { "code":true, "test":true, "doc":true, "comment":"empty" },
"execution.queryable.general]": { "code":true, "test":true, "doc":false, "comment":"nothing testable" },
"execution.forwarding_query": { "code":true, "test":true, "doc":false },
"execution.queryable.concepts": { "code":true, "test":true, "doc":false },
"execution.receivers": { "code":true, "test":true, "doc":true, "comment":"empty" },
"execution.senders": { "code":true, "test":true, "doc":true, "comment":"empty" },
Expand Down
4 changes: 2 additions & 2 deletions docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
| [[execution-async.ops](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution-async.ops)] | 🔴 | 🔴 | 🔴 | |
| [[execution.syn](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.syn)] | 🔴 | 🔴 | 🔴 | |
| [[execution.queries](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.queries)] | ✅ | ✅ | ✅ | empty |
| [[execution.forwarding_query](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.forwarding_query)] | 🔴 | 🔴 | 🔴 | |
| [[execution.forwarding_query](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.forwarding_query)] | ✅ | ✅ | 🔴 | |
| [[execution.get_allocator](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.get_allocator)] | 🔴 | 🔴 | 🔴 | |
| [[execution.get_stop_token](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.get_stop_token)] | 🔴 | 🔴 | 🔴 | |
| [[execution.environment.get_env](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.environment.get_env)] | 🔴 | 🔴 | 🔴 | |
Expand All @@ -64,7 +64,7 @@
| [[execution.receivers.set_value](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.receivers.set_value)] | ✅ | ✅ | 🔴 | |
| [[execution.receivers.set_error](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.receivers.set_error)] | ✅ | ✅ | 🔴 | |
| [[execution.receivers.set_stopped](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.receivers.set_stopped)] | ✅ | ✅ | 🔴 | |
| [[execution.opstate](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.opstate)] | 🔴 | 🔴 | 🔴 | |
| [[execution.opstate](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.opstate)] | ✅ | ✅ | 🔴 | |
| [[execution.opstate.start](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.opstate.start)] | ✅ | ✅ | 🔴 | |
| [[execution.senders](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.senders)] | ✅ | ✅ | ✅ | empty |
| [[execution.senders.general](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#execution.senders.general)] | 🔴 | 🔴 | 🔴 | |
Expand Down
3 changes: 3 additions & 0 deletions docs/questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ likely observable.
- [exec.general] use "Mandates: err != exception_ptr() is true."
However, the condition can only be determined at run-time =>
The "Mandates" should be "Precondition".
- [exec.fwd.env] states "Mandates: ... is a core constant expression if
`q` is a core constant expression": I don't know how to possibly
implement that.
37 changes: 37 additions & 0 deletions include/Beman/Execution26/detail/forwarding_query.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// include/Beman/Execution26/detail/forwarding_query.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_FORWARDING_QUERY
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_FORWARDING_QUERY

#include <concepts>
#include <utility>

// ----------------------------------------------------------------------------

namespace Beman::Execution26
{
struct forwarding_query_t
{
template <typename Object>
requires requires(Object&& object, forwarding_query_t const& query)
{
{ ::std::forward<Object>(object).query(query) } noexcept -> ::std::same_as<bool>;
}
constexpr auto operator()(Object&& object) const noexcept -> bool
{
return ::std::forward<Object>(object).query(*this);
}
template <typename Object>
constexpr auto operator()(Object&&) const noexcept -> bool
{
return ::std::derived_from<Object, ::Beman::Execution26::forwarding_query_t>;
}
};

inline constexpr forwarding_query_t forwarding_query{};
}

// ----------------------------------------------------------------------------

#endif
1 change: 1 addition & 0 deletions src/Beman/Execution26/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

list(APPEND execution_tests
exec-fwd-env.pass
exec-opstate.pass
exec-opstate-start.pass
allocator-requirements-general.pass
Expand Down
80 changes: 80 additions & 0 deletions src/Beman/Execution26/tests/exec-fwd-env.pass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// src/Beman/Execution26/tests/exec-fwd-env.pass.cpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <Beman/Execution26/detail/forwarding_query.hpp>
#include <Beman/Execution26/execution.hpp>
#include <test/execution.hpp>
#include <concepts>

// ----------------------------------------------------------------------------

namespace
{
struct derived
: test_std::forwarding_query_t
{
};

template <bool Noexcept = true, typename Result = bool, Result Value = true>
struct static_query
{
constexpr auto query(test_std::forwarding_query_t) noexcept(Noexcept) -> Result
{
return Value;
}
};

struct rvalue_query
{
constexpr auto query(test_std::forwarding_query_t) && noexcept -> bool
{
return true;
}
};

struct const_query
{
constexpr auto query(test_std::forwarding_query_t&&) noexcept -> bool = delete;
constexpr auto query(test_std::forwarding_query_t&) noexcept -> bool = delete;
constexpr auto query(test_std::forwarding_query_t const&) noexcept -> bool
{
return true;
}
};

struct dynamic_query
{
bool value{true};
constexpr auto query(test_std::forwarding_query_t) && noexcept -> bool
{
return value;
}
};
}

auto main(int ac, char*[]) -> int
{
static_assert(std::same_as<test_std::forwarding_query_t const,
decltype(test_std::forwarding_query)>);

static_assert(not test_std::forwarding_query(0));
static_assert(test_std::forwarding_query(derived()));
static_assert(test_std::forwarding_query(static_query<>()));
static_assert(not test_std::forwarding_query(static_query<false>()));
static_assert(not test_std::forwarding_query(static_query<true, int>()));
static_assert(not test_std::forwarding_query(static_query<true, bool, false>()));

static_assert(test_std::forwarding_query(rvalue_query()));
rvalue_query rq{};
static_assert(not test_std::forwarding_query(rq));
rvalue_query crq{};
static_assert(not test_std::forwarding_query(crq));

static_assert(test_std::forwarding_query(const_query()));

static_assert(test_std::forwarding_query(dynamic_query()));
static_assert(test_std::forwarding_query(dynamic_query{true}));
static_assert(not test_std::forwarding_query(dynamic_query{false}));
assert(test_std::forwarding_query(dynamic_query{ac == 1}));
assert(not test_std::forwarding_query(dynamic_query{ac != 1}));
}