Skip to content

Commit

Permalink
Move repeated_invocable to flux/op/requirements.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacy2012 committed Jan 28, 2024
1 parent ebe3899 commit 8163168
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
17 changes: 0 additions & 17 deletions include/flux/core/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,23 +380,6 @@ template <typename T>
struct sequence_traits<T> : T::flux_sequence_traits {};


namespace detail {

template <typename Func, typename E, distance_t N>
struct repeated_invocable_helper {
template <std::size_t I>
using repeater = E;

static inline constexpr bool value = []<std::size_t... Is> (std::index_sequence<Is...>) consteval {
return std::regular_invocable<Func, repeater<Is>...>;
}(std::make_index_sequence<N>{});
};

template <typename Func, typename E, distance_t N>
concept repeated_invocable = repeated_invocable_helper<Func, E, N>::value;

} // namespace detail

} // namespace flux

#endif // FLUX_CORE_CONCEPTS_HPP_INCLUDED
1 change: 1 addition & 0 deletions include/flux/op/cartesian_power_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define FLUX_OP_CARTESIAN_POWER_MAP_HPP_INCLUDED

#include <flux/op/cartesian_base.hpp>
#include <flux/op/requirements.hpp>

namespace flux {

Expand Down
17 changes: 17 additions & 0 deletions include/flux/op/requirements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ concept foldable_ =

} // namespace detail

namespace detail {

template <typename Func, typename E, distance_t N>
struct repeated_invocable_helper {
template <std::size_t I>
using repeater = E;

static inline constexpr bool value = []<std::size_t... Is> (std::index_sequence<Is...>) consteval {
return std::regular_invocable<Func, repeater<Is>...>;
}(std::make_index_sequence<N>{});
};

template <typename Func, typename E, distance_t N>
concept repeated_invocable = repeated_invocable_helper<Func, E, N>::value;

} // namespace detail

FLUX_EXPORT
template <typename Seq, typename Func, typename Init>
concept foldable =
Expand Down

0 comments on commit 8163168

Please sign in to comment.