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
q23utility.h
Go to the documentation of this file.
1
// Copyright (C) 2023 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
Q23UTILITY_H
5
#
define
Q23UTILITY_H
6
7
#
include
<
QtCore
/
qtconfigmacros
.
h
>
8
9
#
include
<
QtCore
/
q20utility
.
h
>
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
QT_BEGIN_NAMESPACE
28
29
namespace
q23
{
30
// like std::forward_like
31
#
ifdef
__cpp_lib_forward_like
32
using
std
::
forward_like
;
33
#
else
34
35
namespace
_detail
{
36
37
// [forward]/6.1 COPY_CONST
38
template
<
typename
A
,
typename
B
>
39
using
copy_const_t
=
std
::
conditional_t
<
40
std
::
is_const_v
<
A
>,
const
B,
41
/* else */
B
42
>;
43
44
// [forward]/6.2 OVERRIDE_REF
45
template
<
typename
A
,
typename
B
>
46
using
override_ref_t
=
std
::
conditional_t
<
47
std
::
is_rvalue_reference_v
<
A
>,
std
::
remove_reference_t
<
B
>&&,
48
/* else */
B
&
49
>;
50
51
// [forward]/6.3 "V"
52
template
<
typename
T
,
typename
U
>
53
using
forward_like_ret_t
=
override_ref_t
<
54
T
&&,
55
copy_const_t
<
56
std
::
remove_reference_t
<
T
>,
57
std
::
remove_reference_t
<
U
>
58
>
59
>;
60
61
}
// namespace detail
62
63
// http://eel.is/c++draft/forward#lib:forward_like
64
template
<
class
T,
class
U>
65
[[nodiscard]]
constexpr
auto
forward_like
(U &&x)
noexcept
66
->
_detail
::
forward_like_ret_t
<
T
,
U
>
67
{
68
using
V = _detail::forward_like_ret_t<T, U>;
69
return
static_cast
<V>(x);
70
}
71
#
endif
// __cpp_lib_forward_like
72
}
// namespace q23
73
74
QT_END_NAMESPACE
75
76
#
endif
/* Q23UTILITY_H */
q23::_detail
Definition
q23utility.h:35
q23
Definition
q23functional.h:28
q23::forward_like
constexpr auto forward_like(U &&x) noexcept -> _detail::forward_like_ret_t< T, U >
Definition
q23utility.h:65
qtbase
src
corelib
global
q23utility.h
Generated on
for Qt by
1.16.1