From 9965ab37f6cfae3d58a0a6e34c76112866ace0b1 Mon Sep 17 00:00:00 2001 From: agate-pris Date: Fri, 18 Mar 2022 19:22:19 +0900 Subject: [PATCH 1/3] Allow the macro RAPIDJSON_DEFAULT_ALLOCATOR to be used in any namespace `RAPIDJSON_DEFAULT_ALLOCATOR` uses names in the namespace `RAPIDJSON_NAMESPACE`. Replace this with a name starting in the global namespace. --- include/rapidjson/document.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 1cdc29c..41f92e8 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -75,7 +75,7 @@ class GenericDocument; User can define this to use CrtAllocator or MemoryPoolAllocator. */ #ifndef RAPIDJSON_DEFAULT_ALLOCATOR -#define RAPIDJSON_DEFAULT_ALLOCATOR MemoryPoolAllocator +#define RAPIDJSON_DEFAULT_ALLOCATOR ::RAPIDJSON_NAMESPACE::MemoryPoolAllocator<::RAPIDJSON_NAMESPACE::CrtAllocator> #endif /*! \def RAPIDJSON_DEFAULT_STACK_ALLOCATOR From 79d7a448e93b449815ab8db7822d7828e48e83f1 Mon Sep 17 00:00:00 2001 From: agate-pris Date: Fri, 18 Mar 2022 19:32:01 +0900 Subject: [PATCH 2/3] Allow the macro RAPIDJSON_DEFAULT_STACK_ALLOCATOR to be used in any namespace RAPIDJSON_DEFAULT_STACK_ALLOCATOR uses names in the namespace `RAPIDJSON_NAMESPACE`. Replace this with a name starting in the global namespace. --- include/rapidjson/document.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 41f92e8..dd29f69 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -85,7 +85,7 @@ class GenericDocument; User can define this to use CrtAllocator or MemoryPoolAllocator. */ #ifndef RAPIDJSON_DEFAULT_STACK_ALLOCATOR -#define RAPIDJSON_DEFAULT_STACK_ALLOCATOR CrtAllocator +#define RAPIDJSON_DEFAULT_STACK_ALLOCATOR ::RAPIDJSON_NAMESPACE::CrtAllocator #endif /*! \def RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY From 386d31ab69c38e3798200d21eb02ea62c98c4591 Mon Sep 17 00:00:00 2001 From: agate-pris Date: Fri, 18 Mar 2022 19:34:11 +0900 Subject: [PATCH 3/3] Allow access to the template parameter StackAllocator in the GenericDocument Add the typedef declaration `StackAllocatorType` to the class template `GenericDocument`. This allows the user to access the template parameter `StackAllocator`. --- include/rapidjson/document.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index dd29f69..74089cb 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -2486,6 +2486,7 @@ public: typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding. typedef GenericValue ValueType; //!< Value type of the document. typedef Allocator AllocatorType; //!< Allocator type from template parameter. + typedef StackAllocator StackAllocatorType; //!< StackAllocator type from template parameter. //! Constructor /*! Creates an empty document of specified type.