mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2026-02-07 10:19:47 +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>
|
template <typename T>
|
||||||
void *destroy(T *p) noexcept {
|
void *destroy(T *p) noexcept {
|
||||||
#if defined(LIBIPC_CPP_17)
|
#if defined(LIBIPC_CPP_17) && !defined(LIBIPC_CC_GNUC)
|
||||||
std::destroy_at(p);
|
std::destroy_at(p);
|
||||||
#else
|
#else
|
||||||
p->~T();
|
p->~T();
|
||||||
@ -57,7 +57,7 @@ template <typename T, std::size_t N>
|
|||||||
void *destroy(T (*p)[N]) noexcept {
|
void *destroy(T (*p)[N]) noexcept {
|
||||||
#if defined(LIBIPC_CPP_20)
|
#if defined(LIBIPC_CPP_20)
|
||||||
std::destroy_at(p);
|
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));
|
std::destroy(std::begin(*p), std::end(*p));
|
||||||
#else
|
#else
|
||||||
for (auto &elem : *p) destroy(std::addressof(elem));
|
for (auto &elem : *p) destroy(std::addressof(elem));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user