Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
q23functional.h
Go to the documentation of this file.
1// Copyright (C) 2022 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#ifndef Q23FUNCTIONAL_H
4#define Q23FUNCTIONAL_H
5
6#include <QtCore/qglobal.h>
7#include <QtCore/q20functional.h>
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. Types and functions defined in this
14// file can reliably be replaced by their std counterparts, once available.
15// You may use these definitions in your own code, but be aware that we
16// will remove them once Qt depends on the C++ version that supports
17// them in namespace std. There will be NO deprecation warning, the
18// definitions will JUST go away.
19//
20// If you can't agree to these terms, don't use these definitions!
21//
22// We mean it.
23//
24
26
27namespace q23 {
28// like std::invoke_r
29#ifdef __cpp_lib_invoke_r
30using std::invoke_r;
31#else
32template <typename R, typename F, typename...Args>
33constexpr
34std::enable_if_t<std::is_invocable_r_v<R, F, Args...>, R>
35invoke_r(F&& f, Args&&... args)
36 noexcept(std::is_nothrow_invocable_r_v<R, F, Args...>)
37{
38 // ### use q20::invoke for a constexpr std::invoke
39 if constexpr (std::is_void_v<R>)
40 std::invoke(std::forward<F>(f), std::forward<Args>(args)...);
41 else
42 return std::invoke(std::forward<F>(f), std::forward<Args>(args)...);
43}
44#endif // __cpp_lib_invoke_r
45} // namespace q23
46
48
49#endif /* Q23FUNCTIONAL_H */
Combined button and popup list for selecting options.
constexpr std::enable_if_t< std::is_invocable_r_v< R, F, Args... >, R > invoke_r(F &&f, Args &&... args) noexcept(std::is_nothrow_invocable_r_v< R, F, Args... >)
GLfloat GLfloat f
QJSValueList args