Skip to content
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
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ InsertTrailingCommas: None
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: "^STDEXEC_NAMESPACE_STD_BEGIN$"
MacroBlockEnd: "^STDEXEC_NAMESPACE_STD_END$"
MacroBlockBegin: "^STDEXEC_NAMESPACE_STD_BEGIN|STDEXEC_P2300_NAMESPACE_BEGIN$"
MacroBlockEnd: "^STDEXEC_NAMESPACE_STD_END|STDEXEC_P2300_NAMESPACE_END$"
Macros: [
'STDEXEC_CATCH_FALLTHROUGH= ',
'STDEXEC_EXPLICIT_THIS_BEGIN(...)=__VA_ARGS__',
Expand Down
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ aee392a046a26ae2340849fe98e38332d9537397
# new formatting style for improved readability
0cccd586b8d75c64b289e38f334e95846dfb4f33
72666721b5787c1adcc100dd86c26fbbe8bda82f

# inform clang-format that `STDEXEC_P2300_NAMESPACE_BEGIN()` opens a scope
9207f741ec54cb8d5e437385a083459da69ccaa6
2 changes: 1 addition & 1 deletion include/stdexec/__detail/__basic_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace STDEXEC
noexcept(__nothrow_decay_copyable<_CvData>)
: __rcvr_(static_cast<_Receiver&&>(__rcvr))
, __data_(STDEXEC::__allocator_aware_forward(static_cast<_CvData&&>(__data), __rcvr_))
{ }
{}

STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS
_Receiver __rcvr_;
Expand Down
40 changes: 20 additions & 20 deletions include/stdexec/__detail/__execution_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,30 +325,30 @@ namespace experimental::execution
namespace exec = experimental::execution;

STDEXEC_P2300_NAMESPACE_BEGIN()
struct forwarding_query_t;
struct get_allocator_t;
struct get_stop_token_t;

extern forwarding_query_t const forwarding_query;
extern get_allocator_t const get_allocator;
extern get_stop_token_t const get_stop_token;

template <class _Env>
using stop_token_of_t = STDEXEC::__decay_t<STDEXEC::__call_result_t<get_stop_token_t, _Env>>;

struct never_stop_token;
class inplace_stop_source;
class inplace_stop_token;
template <class _Fn>
class inplace_stop_callback;
struct forwarding_query_t;
struct get_allocator_t;
struct get_stop_token_t;

extern forwarding_query_t const forwarding_query;
extern get_allocator_t const get_allocator;
extern get_stop_token_t const get_stop_token;

template <class _Env>
using stop_token_of_t = STDEXEC::__decay_t<STDEXEC::__call_result_t<get_stop_token_t, _Env>>;

struct never_stop_token;
class inplace_stop_source;
class inplace_stop_token;
template <class _Fn>
class inplace_stop_callback;
STDEXEC_P2300_NAMESPACE_END()

////////////////////////////////////////////////////////////////////////////////////////////////////
STDEXEC_P2300_NAMESPACE_BEGIN(this_thread)
struct sync_wait_t;
struct sync_wait_with_variant_t;
extern sync_wait_t const sync_wait;
extern sync_wait_with_variant_t const sync_wait_with_variant;
struct sync_wait_t;
struct sync_wait_with_variant_t;
extern sync_wait_t const sync_wait;
extern sync_wait_with_variant_t const sync_wait_with_variant;
STDEXEC_P2300_NAMESPACE_END(this_thread)

// NOT TO SPEC: make sync_wait et. al. available in namespace STDEXEC (possibly
Expand Down
46 changes: 23 additions & 23 deletions include/stdexec/__detail/__queries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,31 +134,31 @@ namespace STDEXEC
} // namespace STDEXEC

STDEXEC_P2300_NAMESPACE_BEGIN()
//////////////////////////////////////////////////////////////////////////////////
// [exec.get.allocator]
struct get_allocator_t : STDEXEC::__query<get_allocator_t>
{
using STDEXEC::__query<get_allocator_t>::operator();
//////////////////////////////////////////////////////////////////////////////////
// [exec.get.allocator]
struct get_allocator_t : STDEXEC::__query<get_allocator_t>
{
using STDEXEC::__query<get_allocator_t>::operator();

// defined in __read_env.hpp
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto operator()() const noexcept;
// defined in __read_env.hpp
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto operator()() const noexcept;

template <class _Env>
STDEXEC_ATTRIBUTE(always_inline, host, device)
static constexpr void __validate() noexcept
{
static_assert(STDEXEC::__nothrow_callable<get_allocator_t, _Env const &>);
using __alloc_t = STDEXEC::__call_result_t<get_allocator_t, _Env const &>;
static_assert(STDEXEC::__simple_allocator<STDEXEC::__decay_t<__alloc_t>>);
}
template <class _Env>
STDEXEC_ATTRIBUTE(always_inline, host, device)
static constexpr void __validate() noexcept
{
static_assert(STDEXEC::__nothrow_callable<get_allocator_t, _Env const &>);
using __alloc_t = STDEXEC::__call_result_t<get_allocator_t, _Env const &>;
static_assert(STDEXEC::__simple_allocator<STDEXEC::__decay_t<__alloc_t>>);
}

STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
static consteval auto query(forwarding_query_t) noexcept -> bool
{
return true;
}
};
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
static consteval auto query(forwarding_query_t) noexcept -> bool
{
return true;
}
};

inline constexpr get_allocator_t get_allocator{};
inline constexpr get_allocator_t get_allocator{};
STDEXEC_P2300_NAMESPACE_END()
28 changes: 14 additions & 14 deletions include/stdexec/__detail/__query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,22 @@ namespace STDEXEC
} // namespace STDEXEC

STDEXEC_P2300_NAMESPACE_BEGIN()
struct forwarding_query_t
{
template <class _Query>
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
consteval auto operator()(_Query) const noexcept -> bool
struct forwarding_query_t
{
if constexpr (STDEXEC::__queryable_with<_Query, forwarding_query_t>)
{
return STDEXEC::__query<forwarding_query_t>()(_Query());
}
else
template <class _Query>
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
consteval auto operator()(_Query) const noexcept -> bool
{
return STDEXEC::__std::derived_from<_Query, forwarding_query_t>;
if constexpr (STDEXEC::__queryable_with<_Query, forwarding_query_t>)
{
return STDEXEC::__query<forwarding_query_t>()(_Query());
}
else
{
return STDEXEC::__std::derived_from<_Query, forwarding_query_t>;
}
}
}
};
};

inline constexpr forwarding_query_t forwarding_query{};
inline constexpr forwarding_query_t forwarding_query{};
STDEXEC_P2300_NAMESPACE_END()
20 changes: 10 additions & 10 deletions include/stdexec/__detail/__read_env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ namespace STDEXEC
} // namespace STDEXEC

STDEXEC_P2300_NAMESPACE_BEGIN()
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto get_allocator_t::operator()() const noexcept
{
return STDEXEC::read_env(get_allocator);
}
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto get_allocator_t::operator()() const noexcept
{
return STDEXEC::read_env(get_allocator);
}

STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto get_stop_token_t::operator()() const noexcept
{
return STDEXEC::read_env(get_stop_token);
}
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto get_stop_token_t::operator()() const noexcept
{
return STDEXEC::read_env(get_stop_token);
}
STDEXEC_P2300_NAMESPACE_END()
126 changes: 63 additions & 63 deletions include/stdexec/__detail/__stop_token.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,80 +26,80 @@

STDEXEC_P2300_NAMESPACE_BEGIN()

template <template <class> class _Callback>
struct __check_type_alias_exists;
template <template <class> class _Callback>
struct __check_type_alias_exists;

template <class _StopToken>
inline constexpr bool __has_stop_callback_v = requires {
typename __check_type_alias_exists<_StopToken::template callback_type>;
};

#if defined(__cpp_lib_jthread) && __cpp_lib_jthread >= 2019'11L
template <>
inline constexpr bool __has_stop_callback_v<std::stop_token> = true;
#endif

template <class _Token>
struct __stop_callback_for
{
template <class _Callback>
using __f = _Token::template callback_type<_Callback>;
};
template <class _StopToken>
inline constexpr bool __has_stop_callback_v = requires {
typename __check_type_alias_exists<_StopToken::template callback_type>;
};

#if defined(__cpp_lib_jthread) && __cpp_lib_jthread >= 2019'11L
template <>
struct __stop_callback_for<std::stop_token>
{
template <class _Callback>
using __f = std::stop_callback<_Callback>;
};
template <>
inline constexpr bool __has_stop_callback_v<std::stop_token> = true;
#endif

template <class _Token, class _Callback>
using stop_callback_for_t = STDEXEC::__mcall1<__stop_callback_for<_Token>, _Callback>;

template <class _Token>
concept stoppable_token =
requires(_Token const __token) {
requires __has_stop_callback_v<_Token>;
{ __token.stop_requested() } noexcept -> STDEXEC::__boolean_testable_;
{ __token.stop_possible() } noexcept -> STDEXEC::__boolean_testable_;
{ _Token(__token) } noexcept;
} && STDEXEC::__std::copyable<_Token> //
&& STDEXEC::__std::equality_comparable<_Token>;

template <class _Token>
concept unstoppable_token =
stoppable_token<_Token> //
&& requires {
{ _Token::stop_possible() } -> STDEXEC::__boolean_testable_;
} //
&& (!_Token::stop_possible());

// [stoptoken.never], class never_stop_token
struct never_stop_token
{
private:
struct __callback_type
template <class _Token>
struct __stop_callback_for
{
constexpr explicit __callback_type(never_stop_token, STDEXEC::__ignore) noexcept {}
template <class _Callback>
using __f = _Token::template callback_type<_Callback>;
};
public:
template <class>
using callback_type = __callback_type;

static constexpr auto stop_requested() noexcept -> bool
#if defined(__cpp_lib_jthread) && __cpp_lib_jthread >= 2019'11L
template <>
struct __stop_callback_for<std::stop_token>
{
return false;
}
template <class _Callback>
using __f = std::stop_callback<_Callback>;
};
#endif

static constexpr auto stop_possible() noexcept -> bool
template <class _Token, class _Callback>
using stop_callback_for_t = STDEXEC::__mcall1<__stop_callback_for<_Token>, _Callback>;

template <class _Token>
concept stoppable_token =
requires(_Token const __token) {
requires __has_stop_callback_v<_Token>;
{ __token.stop_requested() } noexcept -> STDEXEC::__boolean_testable_;
{ __token.stop_possible() } noexcept -> STDEXEC::__boolean_testable_;
{ _Token(__token) } noexcept;
} && STDEXEC::__std::copyable<_Token> //
&& STDEXEC::__std::equality_comparable<_Token>;

template <class _Token>
concept unstoppable_token =
stoppable_token<_Token> //
&& requires {
{ _Token::stop_possible() } -> STDEXEC::__boolean_testable_;
} //
&& (!_Token::stop_possible());

// [stoptoken.never], class never_stop_token
struct never_stop_token
{
return false;
}

constexpr auto operator==(never_stop_token const &) const noexcept -> bool = default;
};
private:
struct __callback_type
{
constexpr explicit __callback_type(never_stop_token, STDEXEC::__ignore) noexcept { }
};
public:
template <class>
using callback_type = __callback_type;

static constexpr auto stop_requested() noexcept -> bool
{
return false;
}

static constexpr auto stop_possible() noexcept -> bool
{
return false;
}

constexpr auto operator==(never_stop_token const &) const noexcept -> bool = default;
};
STDEXEC_P2300_NAMESPACE_END()

namespace STDEXEC
Expand Down
Loading
Loading