Skip to content

Commit cf9d2ca

Browse files
committed
Remove _canonical_fn<queries<>> specialization
This diff adds support for `erase` and `operator[]` to `__static_vector<T, 0>`, which allows me to delete the specialization of `_canonical_fn<queries<>>` because empty query lists can be sorted and uniqued uniformly.
1 parent b99cf4f commit cf9d2ca

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

include/exec/function.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,6 @@ namespace experimental::execution
304304
}
305305
};
306306

307-
template <>
308-
struct _canonical_fn<queries<>>
309-
{
310-
consteval auto operator()() const noexcept
311-
{
312-
return queries<>();
313-
}
314-
};
315-
316307
template <class Sigs>
317308
inline constexpr _canonical_fn<Sigs> _canonical{};
318309

include/stdexec/__detail/__static_vector.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ namespace STDEXEC
159159

160160
__static_vector() = default;
161161

162+
[[nodiscard]]
163+
constexpr auto operator[](std::size_t) noexcept -> value_type &
164+
{
165+
STDEXEC_ASSERT(false);
166+
}
167+
168+
[[nodiscard]]
169+
constexpr auto operator[](std::size_t) const noexcept -> value_type const &
170+
{
171+
STDEXEC_ASSERT(false);
172+
}
173+
162174
[[nodiscard]]
163175
constexpr auto begin() noexcept -> iterator
164176
{
@@ -194,6 +206,14 @@ namespace STDEXEC
194206
{
195207
return 0;
196208
}
209+
210+
constexpr auto erase(const_iterator __first, const_iterator __last) noexcept -> iterator
211+
{
212+
STDEXEC_ASSERT(__first == __last);
213+
STDEXEC_ASSERT(__first == nullptr);
214+
215+
return end();
216+
}
197217
};
198218

199219
template <class _First, __same_as<_First>... _Rest>

0 commit comments

Comments
 (0)