IPC: QSharedMemory: use q20::construct_at

Commit 72c2cdbc57 said "Move the helper
from qsharedmemory.cpp" but didn't actually move it probably because
commit 72c2cdbc57 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:
Thiago Macieira 2023-03-27 16:33:12 -06:00
parent 80c6f378e7
commit bc99f84478

View File

@ -7,6 +7,7 @@
#include "qtipccommon_p.h"
#include "qsystemsemaphore.h"
#include <q20memory.h>
#include <qdebug.h>
#ifdef Q_OS_WIN
# include <qt_windows.h>
@ -23,15 +24,6 @@ QT_BEGIN_NAMESPACE
using namespace QtIpcCommon;
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()
{
destructBackend();
@ -39,6 +31,7 @@ QSharedMemoryPrivate::~QSharedMemoryPrivate()
inline void QSharedMemoryPrivate::constructBackend()
{
using namespace q20;
visit([](auto p) { construct_at(p); });
}