尝试修正gcc与vc在destroy时的不一致行为

This commit is contained in:
mutouyun 2022-03-01 10:48:08 +08:00
parent 67bdae6fd7
commit 9fc6cca601

View File

@ -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));