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
19 changes: 19 additions & 0 deletions include/stdexec/__detail/__concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,23 @@ namespace STDEXEC {
template <class _Ty, class... _Us>
requires __none_of<_Ty, _Us...>
using __unless_one_of_t = _Ty;

namespace __detail {
template <class _Alloc>
auto __test_alloc_pointer(int) -> typename _Alloc::pointer;
template <class _Alloc>
auto __test_alloc_pointer(long) -> typename _Alloc::value_type*;

template <class _Alloc>
using __alloc_pointer_t = decltype(__detail::__test_alloc_pointer<__decay_t<_Alloc>>(0));
} // namespace __detail

template <class _Alloc>
concept __allocator_ = //
requires(__decay_t<_Alloc>& __alloc, std::size_t __bytes) {
{ __alloc.allocate(__bytes) } -> same_as<__detail::__alloc_pointer_t<_Alloc>>;
__alloc.deallocate(__alloc.allocate(__bytes), __bytes);
} //
&& copy_constructible<__decay_t<_Alloc>> //
&& equality_comparable<__decay_t<_Alloc>>;
} // namespace STDEXEC
6 changes: 1 addition & 5 deletions include/stdexec/__detail/__queries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ namespace STDEXEC {
//////////////////////////////////////////////////////////////////////////////////////////////////
// [exec.queries]
namespace __queries {
// TODO: implement allocator concept
template <class _T0>
concept __allocator_c = true;

//////////////////////////////////////////////////////////////////////////////////
// [exec.get.allocator]
struct get_allocator_t : __query<get_allocator_t> {
Expand All @@ -44,7 +40,7 @@ namespace STDEXEC {
STDEXEC_ATTRIBUTE(always_inline, host, device)
static constexpr void __validate() noexcept {
static_assert(__nothrow_callable<get_allocator_t, const _Env&>);
static_assert(__allocator_c<__call_result_t<get_allocator_t, const _Env&>>);
static_assert(__allocator_<__call_result_t<get_allocator_t, const _Env&>>);
}

STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
Expand Down
Loading