IPC: QSharedMemory: use q20::construct_at
Commit72c2cdbc57
said "Move the helper from qsharedmemory.cpp" but didn't actually move it probably because commit72c2cdbc57
got cherry-picked to 6.5 but the original introduction to qsharedmemory.cpp didn't. So do it now. Change-Id: Idd5e1bb52be047d7b4fffffd175067701d4ea58c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
80c6f378e7
commit
bc99f84478
@ -7,6 +7,7 @@
|
|||||||
#include "qtipccommon_p.h"
|
#include "qtipccommon_p.h"
|
||||||
#include "qsystemsemaphore.h"
|
#include "qsystemsemaphore.h"
|
||||||
|
|
||||||
|
#include <q20memory.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# include <qt_windows.h>
|
# include <qt_windows.h>
|
||||||
@ -23,15 +24,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
using namespace QtIpcCommon;
|
using namespace QtIpcCommon;
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
#if __cplusplus >= 202002L
|
|
||||||
using std::construct_at;
|
|
||||||
#else
|
|
||||||
template <typename T> static void construct_at(T *ptr)
|
|
||||||
{
|
|
||||||
new (ptr) T;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QSharedMemoryPrivate::~QSharedMemoryPrivate()
|
QSharedMemoryPrivate::~QSharedMemoryPrivate()
|
||||||
{
|
{
|
||||||
destructBackend();
|
destructBackend();
|
||||||
@ -39,6 +31,7 @@ QSharedMemoryPrivate::~QSharedMemoryPrivate()
|
|||||||
|
|
||||||
inline void QSharedMemoryPrivate::constructBackend()
|
inline void QSharedMemoryPrivate::constructBackend()
|
||||||
{
|
{
|
||||||
|
using namespace q20;
|
||||||
visit([](auto p) { construct_at(p); });
|
visit([](auto p) { construct_at(p); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user