4#ifndef QMULTIMEDIA_RANGES_P_H
5#define QMULTIMEDIA_RANGES_P_H
18#include <QtCore/qtconfigmacros.h>
20#ifdef __cpp_lib_ranges
32#ifdef __cpp_lib_ranges
51inline constexpr auto all_of = [](
const auto &range,
auto predicate) {
52 return std::all_of(
std::begin(range),
std::end(range),
std::move(predicate));
55inline constexpr auto any_of = [](
const auto &range,
auto predicate) {
56 return std::any_of(
std::begin(range),
std::end(range),
std::move(predicate));
59inline constexpr auto copy = [](
const auto &in,
const auto &out) {
60 return std::copy(in.begin(), in.end(), out);
63inline constexpr auto equal = [](
const auto &lhs,
const auto &rhs,
auto predicate) {
64 return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
std::move(predicate));
67inline constexpr auto fill = [](
auto &range,
auto value) {
68 return std::fill(
std::begin(range),
std::end(range),
std::move(value));
71inline constexpr auto find = [](
const auto &range,
const auto &value) {
72 return std::find(
std::begin(range),
std::end(range), value);
75inline constexpr auto find_if = [](
const auto &range,
auto predicate) {
76 return std::find_if(
std::begin(range),
std::end(range),
std::move(predicate));
83 template <
typename Range,
typename Comp =
std::
less<>>
84 auto operator()(
const Range &range, Comp comp)
const
86 auto it =
std::max_element(
std::begin(range),
std::end(range),
std::move(comp));
90 template <
typename Range>
93 auto it =
std::max_element(
std::begin(range),
std::end(range));
100 template <
typename Range,
typename Comp =
std::
less<>>
101 auto operator()(
const Range &range, Comp comp)
const
103 return std::max_element(
std::begin(range),
std::end(range),
std::move(comp));
106 template <
typename Range>
109 return std::max_element(
std::begin(range),
std::end(range));
115 template <
typename Range,
typename Comp =
std::
less<>>
116 auto operator()(
const Range &range, Comp comp)
const
118 auto it =
std::min_element(
std::begin(range),
std::end(range),
std::move(comp));
122 template <
typename Range>
125 auto it =
std::min_element(
std::begin(range),
std::end(range));
132 template <
typename Range,
typename Comp =
std::
less<>>
133 auto operator()(
const Range &range, Comp comp)
const
135 return std::min_element(
std::begin(range),
std::end(range),
std::move(comp));
138 template <
typename Range>
141 return std::min_element(
std::begin(range),
std::end(range));
147 template <
typename Range,
typename Comp =
std::
less<>>
150 std::sort(
std::begin(range),
std::end(range),
std::move(comp));
153 template <
typename Range>
156 std::sort(
std::begin(range),
std::end(range));
162 template <
typename Range,
typename Comp =
std::
less<>>
165 std::stable_sort(
std::begin(range),
std::end(range),
std::move(comp));
168 template <
typename Range>
171 std::stable_sort(
std::begin(range),
std::end(range));
186#if __cpp_lib_ranges_contains >= 202207L
190inline constexpr auto contains = [](
const auto &range,
const auto &value) {
191 return std::find(
std::begin(range),
std::end(range), value) !=
std::end(range);