summaryrefslogtreecommitdiffstats
path: root/Common/interface
diff options
context:
space:
mode:
authorEgor <egor.yusov@gmail.com>2018-11-03 06:00:33 +0000
committerEgor <egor.yusov@gmail.com>2018-11-03 06:00:33 +0000
commitfdfd3b6dd70be5a8d456d6837758aa43a90ab3cc (patch)
tree08fcf5f176ccacd241bf5f2c5480501e02833991 /Common/interface
parentFixed Vulkan validation error message about incorrect buffer offset alignment... (diff)
downloadDiligentCore-fdfd3b6dd70be5a8d456d6837758aa43a90ab3cc.tar.gz
DiligentCore-fdfd3b6dd70be5a8d456d6837758aa43a90ab3cc.zip
Fixed few linux build issues
Diffstat (limited to 'Common/interface')
-rw-r--r--Common/interface/STDAllocator.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/Common/interface/STDAllocator.h b/Common/interface/STDAllocator.h
index 10f6769a..2371bdb8 100644
--- a/Common/interface/STDAllocator.h
+++ b/Common/interface/STDAllocator.h
@@ -34,6 +34,17 @@
namespace Diligent
{
+template <typename T>
+typename std::enable_if<std::is_destructible<T>::value, void>::type Destruct(T *ptr)
+{
+ ptr->~T();
+}
+
+template <typename T>
+typename std::enable_if<!std::is_destructible<T>::value, void>::type Destruct(T *ptr)
+{
+}
+
template <typename T, typename AllocatorType>
struct STDAllocator
{
@@ -183,7 +194,7 @@ struct STDDeleter
void operator()(T *ptr) noexcept
{
VERIFY(m_Allocator != nullptr, "The deleter has been moved away or never initialized, and can't be used");
- ptr->~T();
+ Destruct(ptr);
m_Allocator->Free(ptr);
}