4#ifndef QMULTIMEDIA_RANGES_P_H
5#define QMULTIMEDIA_RANGES_P_H
18#include <QtCore/qtconfigmacros.h>
20#ifdef __cpp_lib_ranges
31#ifdef __cpp_lib_ranges
50inline constexpr auto all_of = [](
const auto &range,
auto predicate) {
51 return std::all_of(
std::begin(range),
std::end(range),
std::move(predicate));
54inline constexpr auto any_of = [](
const auto &range,
auto predicate) {
55 return std::any_of(
std::begin(range),
std::end(range),
std::move(predicate));
58inline constexpr auto copy = [](
const auto &in,
const auto &out) {
59 return std::copy(in.begin(), in.end(), out);
62inline constexpr auto equal = [](
const auto &lhs,
const auto &rhs,
auto predicate) {
63 return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
std::move(predicate));
66inline constexpr auto fill = [](
auto &range,
auto value) {
67 return std::fill(
std::begin(range),
std::end(range),
std::move(value));
70inline constexpr auto find = [](
const auto &range,
const auto &value) {
71 return std::find(
std::begin(range),
std::end(range), value);
74inline constexpr auto find_if = [](
const auto &range,
auto predicate) {
75 return std::find_if(
std::begin(range),
std::end(range),
std::move(predicate));
82 template <
typename Range,
typename Comp =
std::
less<>>
83 auto operator()(
const Range &range, Comp comp)
const
85 auto it =
std::max_element(
std::begin(range),
std::end(range),
std::move(comp));
89 template <
typename Range>
92 auto it =
std::max_element(
std::begin(range),
std::end(range));
99 template <
typename Range,
typename Comp =
std::
less<>>
100 auto operator()(
const Range &range, Comp comp)
const
102 return std::max_element(
std::begin(range),
std::end(range),
std::move(comp));
105 template <
typename Range>
108 return std::max_element(
std::begin(range),
std::end(range));
114 template <
typename Range,
typename Comp =
std::
less<>>
115 auto operator()(
const Range &range, Comp comp)
const
117 auto it =
std::min_element(
std::begin(range),
std::end(range),
std::move(comp));
121 template <
typename Range>
124 auto it =
std::min_element(
std::begin(range),
std::end(range));
131 template <
typename Range,
typename Comp =
std::
less<>>
132 auto operator()(
const Range &range, Comp comp)
const
134 return std::min_element(
std::begin(range),
std::end(range),
std::move(comp));
137 template <
typename Range>
140 return std::min_element(
std::begin(range),
std::end(range));
146 template <
typename Range,
typename Comp =
std::
less<>>
149 std::sort(
std::begin(range),
std::end(range),
std::move(comp));
152 template <
typename Range>
155 std::sort(
std::begin(range),
std::end(range));
161 template <
typename Range,
typename Comp =
std::
less<>>
164 std::stable_sort(
std::begin(range),
std::end(range),
std::move(comp));
167 template <
typename Range>
170 std::stable_sort(
std::begin(range),
std::end(range));
185#if __cpp_lib_ranges_contains >= 202207L
189inline constexpr auto contains = [](
const auto &range,
const auto &value) {
190 return std::find(
std::begin(range),
std::end(range), value) !=
std::end(range);