Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qmultimedia_ranges_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QMULTIMEDIA_RANGES_P_H
5#define QMULTIMEDIA_RANGES_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qtconfigmacros.h>
19
20#ifdef __cpp_lib_ranges
21# include <ranges> // IWYU pragma: export
22#endif
23
24#include <algorithm>
25
26QT_BEGIN_NAMESPACE
27
29
30#ifdef __cpp_lib_ranges
31using std::ranges::equal;
32using std::ranges::fill;
33
34#else
35
36// Caveat: best effort, not a 1-to-1 mapping to c++20 style ranges
37
38constexpr auto equal = [](const auto &lhs, const auto &rhs, auto &&predicate) {
39 return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), predicate);
40};
41
42constexpr auto fill = [](auto &range, auto &&value) {
43 return std::fill(std::begin(range), std::end(range), value);
44};
45
46#endif
47
48} // namespace QtMultimediaPrivate::ranges
49
50QT_END_NAMESPACE
51
52#endif // QMULTIMEDIA_RANGES_P_H