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
q17memory.h
Go to the documentation of this file.
1
// Copyright (C) 2024 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
Q17MEMORY_H
5
#
define
Q17MEMORY_H
6
7
#
include
<
QtCore
/
qexceptionhandling
.
h
>
8
#
include
<
QtCore
/
qtconfigmacros
.
h
>
9
10
#
include
<
iterator
>
11
#
include
<
memory
>
12
13
QT_BEGIN_NAMESPACE
14
15
namespace
q17
{
16
// like std::uninitialized_value_construct
17
#
if
!
defined
(
Q_OS_VXWORKS
)
18
using
std
::uninitialized_value_construct;
19
#
else
20
namespace
_detail
{
21
template
<
typename
T
>
22
void
*
voidify
(
T
&
t
) {
23
// LWG3870 changed this for C++23, but this is q_17_, so use the C++17/20 version:
24
return
const_cast
<
void
*>(
static_cast
<
const
volatile
void
*>(
std
::
addressof
(
t
)));
25
}
26
}
// namespace _detail
27
// WindRiver confirmed that implementation of `std::uninitialized_value_construct` is not
28
// working properly in VxWorks 24.03 (probably the same problem appears in older versions) with
29
// defect VXHVP-9969
30
template
<
typename
ForwardIt
>
31
void
uninitialized_value_construct
(
ForwardIt
first
,
ForwardIt
last
)
32
{
33
auto
current
=
first
;
34
using
ValueType
=
typename
std
::
iterator_traits
<
ForwardIt
>::
value_type
;
35
QT_TRY
{
36
for
(;
current
!=
last
; ++
current
)
37
::
new
(
_detail
::
voidify
(*
current
))
ValueType
();
38
}
QT_CATCH
(...) {
39
std
::
destroy
(
first
,
current
);
40
QT_RETHROW
;
41
}
42
}
43
#
endif
// Q_OS_VXWORKS
44
}
// namespace q17
45
46
QT_END_NAMESPACE
47
48
#
endif
// Q17MEMORY_H
q17
Definition
q17memory.h:15
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtbase
src
corelib
global
q17memory.h
Generated on
for Qt by
1.16.1