Skip to content

Commit

Permalink
Use num::integral rather than std::integral...
Browse files Browse the repository at this point in the history
...in function arguments, because I don't think flux::chunk(seq, 'a') is something we should allow.
  • Loading branch information
tcbrindle committed Aug 23, 2024
1 parent 1f3ce4b commit 5d2dce5
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions include/flux/core/inline_sequence_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ struct inline_sequence_base {
(multipass_sequence<Derived> && not infinite_sequence<Derived>);

[[nodiscard]]
constexpr auto chunk(std::integral auto chunk_sz) &&;
constexpr auto chunk(num::integral auto chunk_sz) &&;

template <typename Pred>
requires multipass_sequence<Derived> &&
Expand All @@ -251,15 +251,15 @@ struct inline_sequence_base {
requires infinite_sequence<Derived> || multipass_sequence<Derived>;

[[nodiscard]]
constexpr auto cycle(std::integral auto count) && requires multipass_sequence<Derived>;
constexpr auto cycle(num::integral auto count) && requires multipass_sequence<Derived>;

[[nodiscard]]
constexpr auto dedup() &&
requires multipass_sequence<Derived> &&
std::equality_comparable<element_t<Derived>>;

[[nodiscard]]
constexpr auto drop(std::integral auto count) &&;
constexpr auto drop(num::integral auto count) &&;

template <typename Pred>
requires std::predicate<Pred&, element_t<Derived>>
Expand Down Expand Up @@ -338,7 +338,7 @@ struct inline_sequence_base {
constexpr auto scan_first(Func func) &&;

[[nodiscard]]
constexpr auto slide(std::integral auto win_sz) && requires multipass_sequence<Derived>;
constexpr auto slide(num::integral auto win_sz) && requires multipass_sequence<Derived>;

template <typename Pattern>
requires multipass_sequence<Derived> &&
Expand All @@ -364,10 +364,10 @@ struct inline_sequence_base {
constexpr auto split_string(Pattern&& pattern) &&;

[[nodiscard]]
constexpr auto stride(std::integral auto by) &&;
constexpr auto stride(num::integral auto by) &&;

[[nodiscard]]
constexpr auto take(std::integral auto count) &&;
constexpr auto take(num::integral auto count) &&;

template <typename Pred>
requires std::predicate<Pred&, element_t<Derived>>
Expand Down
4 changes: 2 additions & 2 deletions include/flux/op/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ struct chunk_adaptor<Base> : inline_sequence_base<chunk_adaptor<Base>> {
struct chunk_fn {
template <adaptable_sequence Seq>
[[nodiscard]]
constexpr auto operator()(Seq&& seq, std::integral auto chunk_sz) const
constexpr auto operator()(Seq&& seq, num::integral auto chunk_sz) const
-> sequence auto
{
FLUX_ASSERT(chunk_sz > 0);
Expand All @@ -312,7 +312,7 @@ struct chunk_fn {
FLUX_EXPORT inline constexpr auto chunk = detail::chunk_fn{};

template <typename D>
constexpr auto inline_sequence_base<D>::chunk(std::integral auto chunk_sz) &&
constexpr auto inline_sequence_base<D>::chunk(num::integral auto chunk_sz) &&
{
return flux::chunk(std::move(derived()), chunk_sz);
}
Expand Down
4 changes: 2 additions & 2 deletions include/flux/op/cycle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ struct cycle_fn {
template <adaptable_sequence Seq>
requires multipass_sequence<Seq>
[[nodiscard]]
constexpr auto operator()(Seq&& seq, std::integral auto count) const
constexpr auto operator()(Seq&& seq, num::integral auto count) const
-> multipass_sequence auto
{
auto c = num::checked_cast<distance_t>(count);
Expand All @@ -249,7 +249,7 @@ constexpr auto inline_sequence_base<D>::cycle() &&
}

template <typename D>
constexpr auto inline_sequence_base<D>::cycle(std::integral auto count) &&
constexpr auto inline_sequence_base<D>::cycle(num::integral auto count) &&
requires multipass_sequence<D>
{
return flux::cycle(std::move(derived()), count);
Expand Down
4 changes: 2 additions & 2 deletions include/flux/op/drop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct drop_adaptor : inline_sequence_base<drop_adaptor<Base>> {
struct drop_fn {
template <adaptable_sequence Seq>
[[nodiscard]]
constexpr auto operator()(Seq&& seq, std::integral auto count) const
constexpr auto operator()(Seq&& seq, num::integral auto count) const
{
auto count_ = num::checked_cast<distance_t>(count);
if (count_ < 0) {
Expand All @@ -81,7 +81,7 @@ struct drop_fn {
FLUX_EXPORT inline constexpr auto drop = detail::drop_fn{};

template <typename Derived>
constexpr auto inline_sequence_base<Derived>::drop(std::integral auto count) &&
constexpr auto inline_sequence_base<Derived>::drop(num::integral auto count) &&
{
return flux::drop(std::move(derived()), count);
}
Expand Down
2 changes: 1 addition & 1 deletion include/flux/op/slide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct slide_fn {
FLUX_EXPORT inline constexpr auto slide = detail::slide_fn{};

template <typename D>
constexpr auto inline_sequence_base<D>::slide(std::integral auto win_sz) &&
constexpr auto inline_sequence_base<D>::slide(num::integral auto win_sz) &&
requires multipass_sequence<D>
{
FLUX_ASSERT(win_sz > 0);
Expand Down
4 changes: 2 additions & 2 deletions include/flux/op/stride.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ struct stride_adaptor<Base> : inline_sequence_base<stride_adaptor<Base>> {
struct stride_fn {
template <adaptable_sequence Seq>
[[nodiscard]]
constexpr auto operator()(Seq&& seq, std::integral auto by) const
constexpr auto operator()(Seq&& seq, num::integral auto by) const
{
FLUX_ASSERT(by > 0);
return stride_adaptor<std::decay_t<Seq>>(FLUX_FWD(seq),
Expand All @@ -267,7 +267,7 @@ struct stride_fn {
FLUX_EXPORT inline constexpr auto stride = detail::stride_fn{};

template <typename D>
constexpr auto inline_sequence_base<D>::stride(std::integral auto by) &&
constexpr auto inline_sequence_base<D>::stride(num::integral auto by) &&
{
return flux::stride(std::move(derived()), by);
}
Expand Down
4 changes: 2 additions & 2 deletions include/flux/op/take.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct take_adaptor : inline_sequence_base<take_adaptor<Base>>
struct take_fn {
template <adaptable_sequence Seq>
[[nodiscard]]
constexpr auto operator()(Seq&& seq, std::integral auto count) const
constexpr auto operator()(Seq&& seq, num::integral auto count) const
{
auto count_ = num::checked_cast<distance_t>(count);
if (count_ < 0) {
Expand All @@ -164,7 +164,7 @@ struct take_fn {
FLUX_EXPORT inline constexpr auto take = detail::take_fn{};

template <typename Derived>
constexpr auto inline_sequence_base<Derived>::take(std::integral auto count) &&
constexpr auto inline_sequence_base<Derived>::take(num::integral auto count) &&
{
return flux::take(std::move(derived()), count);
}
Expand Down
2 changes: 1 addition & 1 deletion include/flux/source/array_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace detail {
struct make_array_ptr_unchecked_fn {
template <typename T>
requires (std::is_object_v<T> && !std::is_abstract_v<T>)
constexpr auto operator()(T* ptr, std::integral auto size) const -> array_ptr<T>
constexpr auto operator()(T* ptr, num::integral auto size) const -> array_ptr<T>
{
return array_ptr<T>(ptr, num::checked_cast<distance_t>(size));
}
Expand Down
2 changes: 1 addition & 1 deletion include/flux/source/repeat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct repeat_fn {

template <typename T>
requires std::movable<std::decay_t<T>>
constexpr auto operator()(T&& obj, std::integral auto count) const
constexpr auto operator()(T&& obj, num::integral auto count) const
{
auto c = num::checked_cast<distance_t>(count);
if (c < 0) {
Expand Down

0 comments on commit 5d2dce5

Please sign in to comment.