diff --git a/src/libipc/utility/pimpl.h b/src/libipc/utility/pimpl.h index 25074e7..ca0edd3 100755 --- a/src/libipc/utility/pimpl.h +++ b/src/libipc/utility/pimpl.h @@ -3,6 +3,7 @@ #include #include +#include "libipc/platform/detail.h" #include "libipc/utility/concept.h" #include "libipc/pool_alloc.h" @@ -17,49 +18,45 @@ template using IsImplUncomfortable = ipc::require<(sizeof(T) > sizeof(T*)), R>; template -constexpr auto make_impl(P&&... params) -> IsImplComfortable { +IPC_CONSTEXPR_ auto make_impl(P&&... params) -> IsImplComfortable { T* buf {}; ::new (&buf) T { std::forward

(params)... }; return buf; } template -constexpr auto impl(T* const (& p)) -> IsImplComfortable { +IPC_CONSTEXPR_ auto impl(T* const (& p)) -> IsImplComfortable { return reinterpret_cast(&const_cast(reinterpret_cast(p))); } template -constexpr auto clear_impl(T* p) -> IsImplComfortable { +IPC_CONSTEXPR_ auto clear_impl(T* p) -> IsImplComfortable { if (p != nullptr) impl(p)->~T(); } template -constexpr auto make_impl(P&&... params) -> IsImplUncomfortable { +IPC_CONSTEXPR_ auto make_impl(P&&... params) -> IsImplUncomfortable { return mem::alloc(std::forward

(params)...); } template -constexpr auto clear_impl(T* p) -> IsImplUncomfortable { +IPC_CONSTEXPR_ auto clear_impl(T* p) -> IsImplUncomfortable { mem::free(p); } template -constexpr auto impl(T* const (& p)) -> IsImplUncomfortable { +IPC_CONSTEXPR_ auto impl(T* const (& p)) -> IsImplUncomfortable { return p; } template struct pimpl { template - constexpr static T* make(P&&... params) { + IPC_CONSTEXPR_ static T* make(P&&... params) { return make_impl(std::forward

(params)...); } -#if __cplusplus >= 201703L - constexpr void clear() { -#else /*__cplusplus < 201703L*/ - void clear() { -#endif/*__cplusplus < 201703L*/ + IPC_CONSTEXPR_ void clear() { clear_impl(static_cast(const_cast(this))); } };