5static std::random_device
rnd;
7constexpr auto less_than(
auto y) {
return [
y](
auto x) {
return x <
y; }; }
9template<std::random_access_iterator I, std::sentinel_for<I> S>
11 return 0 <= std::distance(
b, e);
14template<std::input_iterator I, std::sentinel_for<I> S>
16 if constexpr(std::forward_iterator<I>)
21template<std::input_iterator I, std::sentinel_for<I> S>
26template<std::forward_iterator I, std::sentinel_for<I> S>
28 using D = std::iter_difference_t<I>;
29 const D
n = std::distance(
b, e);
30 const D i = std::uniform_int_distribution<D>{0,
n - 1}(
rnd);
31 return std::next(
b, i);
34template<std::input_iterator I, std::sentinel_for<I> S>
36 return std::all_of(
b, e, [&
x](
const auto &
y) {
return !(
y <
x); });
39template<std::forward_iterator I, std::sentinel_for<I> S>
45 for(
auto i = std::next(ret); i != e; ++i) {
55template<std::forward_iterator I, std::sentinel_for<I> S>
58 const auto ret = std::partition(std::next(
b), e,
less_than(*
b));
59 std::iter_swap(
b, std::prev(ret));
static const struct board b
Definition chess0.c:57
#define y
Definition gcc14.c:2
#define x
Definition gcc14.c:1
Definition reflexpr.cpp:168
I rand_it(I b, S e)
Definition utils.hpp:27
constexpr auto less_than(auto y)
Definition utils.hpp:7
constexpr bool is_min_element(I b, S e, const auto &x)
Definition utils.hpp:35
I sort_element(I b, I i, S e)
Definition utils.hpp:56
constexpr bool check_range(I b, S e)
Definition utils.hpp:10
constexpr I min_element(I b, S e)
Definition utils.hpp:40
static std::random_device rnd
Definition utils.hpp:5
constexpr bool contains(I b, S e, I i)
Definition utils.hpp:22