From 6bed9b266f248de5d973e16bc27fdc13e68ad15d Mon Sep 17 00:00:00 2001 From: ylavic Date: Tue, 30 Mar 2021 13:47:04 +0200 Subject: [PATCH] Don't define StdAllocator from C++17. --- include/rapidjson/allocators.h | 2 ++ test/unittest/allocatorstest.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/rapidjson/allocators.h b/include/rapidjson/allocators.h index 2871542..711ac30 100644 --- a/include/rapidjson/allocators.h +++ b/include/rapidjson/allocators.h @@ -581,6 +581,7 @@ private: BaseAllocator baseAllocator_; }; +#if !RAPIDJSON_HAS_CXX17 // std::allocator deprecated in C++17 template class StdAllocator : public std::allocator @@ -628,6 +629,7 @@ private: BaseAllocator baseAllocator_; }; +#endif #ifdef __GNUC__ RAPIDJSON_DIAG_POP diff --git a/test/unittest/allocatorstest.cpp b/test/unittest/allocatorstest.cpp index 76e34b5..ec1b2ce 100644 --- a/test/unittest/allocatorstest.cpp +++ b/test/unittest/allocatorstest.cpp @@ -83,8 +83,12 @@ private: template void TestStdAllocator(const Allocator& a) { +#if RAPIDJSON_HAS_CXX17 + typedef StdAllocator BoolAllocator; +#else typedef StdAllocator VoidAllocator; typedef typename VoidAllocator::template rebind::other BoolAllocator; +#endif BoolAllocator ba(a), ba2(a); EXPECT_TRUE(ba == ba2); EXPECT_FALSE(ba!= ba2);