File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -271,4 +271,23 @@ namespace STDEXEC {
271271 template <class _Ty , class ... _Us>
272272 requires __none_of<_Ty, _Us...>
273273 using __unless_one_of_t = _Ty;
274+
275+ namespace __detail {
276+ template <class _Alloc >
277+ auto __test_alloc_pointer (int ) -> typename _Alloc::pointer;
278+ template <class _Alloc >
279+ auto __test_alloc_pointer (long ) -> typename _Alloc::value_type*;
280+
281+ template <class _Alloc >
282+ using __alloc_pointer_t = decltype (__detail::__test_alloc_pointer<__decay_t <_Alloc>>(0 ));
283+ } // namespace __detail
284+
285+ template <class _Alloc >
286+ concept __allocator_ = //
287+ requires (__decay_t <_Alloc>& __alloc, std::size_t __bytes) {
288+ { __alloc.allocate (__bytes) } -> same_as<__detail::__alloc_pointer_t <_Alloc>>;
289+ __alloc.deallocate (__alloc.allocate (__bytes), __bytes);
290+ } //
291+ && copy_constructible<__decay_t <_Alloc>> //
292+ && equality_comparable<__decay_t <_Alloc>>;
274293} // namespace STDEXEC
Original file line number Diff line number Diff line change @@ -27,10 +27,6 @@ namespace STDEXEC {
2727 // ////////////////////////////////////////////////////////////////////////////////////////////////
2828 // [exec.queries]
2929 namespace __queries {
30- // TODO: implement allocator concept
31- template <class _T0 >
32- concept __allocator_c = true ;
33-
3430 // ////////////////////////////////////////////////////////////////////////////////
3531 // [exec.get.allocator]
3632 struct get_allocator_t : __query<get_allocator_t > {
@@ -44,7 +40,7 @@ namespace STDEXEC {
4440 STDEXEC_ATTRIBUTE (always_inline, host, device)
4541 static constexpr void __validate() noexcept {
4642 static_assert (__nothrow_callable<get_allocator_t , const _Env&>);
47- static_assert (__allocator_c <__call_result_t <get_allocator_t , const _Env&>>);
43+ static_assert (__allocator_ <__call_result_t <get_allocator_t , const _Env&>>);
4844 }
4945
5046 STDEXEC_ATTRIBUTE (nodiscard, always_inline, host, device)
You can’t perform that action at this time.
0 commit comments