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
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
// Qt-Security score:significant reason:default
4
#
ifndef
Q23FUNCTIONAL_H
5
#
define
Q23FUNCTIONAL_H
6
7
#
include
<
QtCore
/
qglobal
.
h
>
8
#
include
<
QtCore
/
q20functional
.
h
>
9
10
//
11
// W A R N I N G
12
// -------------
13
//
14
// This file is not part of the Qt API. Types and functions defined in this
15
// file can reliably be replaced by their std counterparts, once available.
16
// You may use these definitions in your own code, but be aware that we
17
// will remove them once Qt depends on the C++ version that supports
18
// them in namespace std. There will be NO deprecation warning, the
19
// definitions will JUST go away.
20
//
21
// If you can't agree to these terms, don't use these definitions!
22
//
23
// We mean it.
24
//
25
26
QT_BEGIN_NAMESPACE
27
28
namespace
q23
{
29
// like std::invoke_r
30
#
ifdef
__cpp_lib_invoke_r
31
using
std
::
invoke_r
;
32
#
else
33
template
<
typename
R
,
typename
F
,
typename
...
Args
>
34
constexpr
35
std
::
enable_if_t
<
std
::
is_invocable_r_v
<
R
,
F
,
Args
...>,
R
>
36
invoke_r
(
F
&&
f
,
Args
&&...
args
)
37
noexcept
(
std
::
is_nothrow_invocable_r_v
<
R
,
F
,
Args
...>)
38
{
39
// ### use q20::invoke for a constexpr std::invoke
40
if
constexpr
(
std
::
is_void_v
<
R
>)
41
std
::
invoke
(
std
::
forward
<
F
>(
f
),
std
::
forward
<
Args
>(
args
)...);
42
else
43
return
std
::
invoke
(
std
::
forward
<
F
>(
f
),
std
::
forward
<
Args
>(
args
)...);
44
}
45
#
endif
// __cpp_lib_invoke_r
46
}
// namespace q23
47
48
QT_END_NAMESPACE
49
50
#
endif
/* Q23FUNCTIONAL_H */
q23
Definition
q23functional.h:28
qtbase
src
corelib
global
q23functional.h
Generated on
for Qt by
1.16.1