mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 17:26:48 +08:00
尝试修正gcc与vc在destroy时的不一致行为
This commit is contained in:
parent
67bdae6fd7
commit
9fc6cca601
@ -45,7 +45,7 @@ auto construct(void *p, A &&... args)
|
||||
|
||||
template <typename T>
|
||||
void *destroy(T *p) noexcept {
|
||||
#if defined(LIBIPC_CPP_17)
|
||||
#if defined(LIBIPC_CPP_17) && !defined(LIBIPC_CC_GNUC)
|
||||
std::destroy_at(p);
|
||||
#else
|
||||
p->~T();
|
||||
@ -57,7 +57,7 @@ template <typename T, std::size_t N>
|
||||
void *destroy(T (*p)[N]) noexcept {
|
||||
#if defined(LIBIPC_CPP_20)
|
||||
std::destroy_at(p);
|
||||
#elif defined(LIBIPC_CPP_17)
|
||||
#elif defined(LIBIPC_CPP_17) && !defined(LIBIPC_CC_GNUC)
|
||||
std::destroy(std::begin(*p), std::end(*p));
|
||||
#else
|
||||
for (auto &elem : *p) destroy(std::addressof(elem));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user