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
q20functional.h
Go to the documentation of this file.
1// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4#ifndef Q20FUNCTIONAL_H
5#define Q20FUNCTIONAL_H
6
7#include <QtCore/qglobal.h>
8
9#include <functional>
10
11//
12// W A R N I N G
13// -------------
14//
15// This file is not part of the Qt API. Types and functions defined in this
16// file can reliably be replaced by their std counterparts, once available.
17// You may use these definitions in your own code, but be aware that we
18// will remove them once Qt depends on the C++ version that supports
19// them in namespace std. There will be NO deprecation warning, the
20// definitions will JUST go away.
21//
22// If you can't agree to these terms, don't use these definitions!
23//
24// We mean it.
25//
26
27#include <functional>
28
29QT_BEGIN_NAMESPACE
30
31namespace q20 {
32// like std::identity
33#ifdef __cpp_lib_ranges
34using std::identity;
35#else
37{
38 struct is_transparent {};
39 template <typename T>
40 constexpr T &&operator()(T&& t) const noexcept { return std::forward<T>(t); }
41};
42#endif // __cpp_lib_ranges
43} // namespace q20
44
45QT_END_NAMESPACE
46
47#endif /* Q20FUNCTIONAL_H */
constexpr T && operator()(T &&t) const noexcept