Changed implementation of vma_aligned_alloc to only use aligned_alloc when C++17 is enabled, where the function is defined.
See #285
May break on some platforms! If it affects you, please enable C++17 or later in your compiler or provide custom implementation of macro VMA_SYSTEM_ALIGNED_MALLOC (and VMA_SYSTEM_ALIGNED_FREE if needed) using the API of your system.
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h
index d090864..6a2223e 100644
--- a/include/vk_mem_alloc.h
+++ b/include/vk_mem_alloc.h
@@ -2745,11 +2745,17 @@
{
return _aligned_malloc(size, alignment);
}
-#else
+#elif __cplusplus >= 201703L // Compiler conforms to C++17.
static void* vma_aligned_alloc(size_t alignment, size_t size)
{
return aligned_alloc(alignment, size);
}
+#else
+static void* vma_aligned_alloc(size_t alignment, size_t size)
+{
+ VMA_ASSERT(0 && "Could not implement aligned_alloc automatically. Please enable C++17 or later in your compiler or provide custom implementation of macro VMA_SYSTEM_ALIGNED_MALLOC (and VMA_SYSTEM_ALIGNED_FREE if needed) using the API of your system.");
+ return VMA_NULL;
+}
#endif
#if defined(_WIN32)