diff --git a/include/mimalloc.h b/include/mimalloc.h index f5900336..c13bda23 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -470,7 +470,9 @@ template bool operator==(const mi_stl_allocator& , const template bool operator!=(const mi_stl_allocator& , const mi_stl_allocator& ) mi_attr_noexcept { return false; } -#if (__cplusplus >= 201103L) || (_MSC_VER > 1900) // C++11 +#if (__cplusplus >= 201103L) || (_MSC_VER >= 1920) // C++11, at least vs2019 +#define MI_HAS_HEAP_STL_ALLOCATOR 1 + #include // std::shared_ptr // Common base class for STL allocators in a specific heap diff --git a/test/main-override.cpp b/test/main-override.cpp index e63d605a..db96efb1 100644 --- a/test/main-override.cpp +++ b/test/main-override.cpp @@ -130,6 +130,7 @@ static bool test_stl_allocator2() { return vec.size() == 0; } +#if MI_HAS_HEAP_STL_ALLOCATOR static bool test_stl_allocator3() { std::vector > vec; vec.push_back(1); @@ -157,14 +158,17 @@ static bool test_stl_allocator6() { vec.pop_back(); return vec.size() == 0; } +#endif static void test_stl_allocators() { test_stl_allocator1(); test_stl_allocator2(); +#if MI_HAS_HEAP_STL_ALLOCATOR test_stl_allocator3(); test_stl_allocator4(); test_stl_allocator5(); test_stl_allocator6(); +#endif } // issue 445