From 4b32a3059368d09948d219deb41023d30c3f8c47 Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Sat, 1 Feb 2014 18:05:12 +0100 Subject: [PATCH] MemoryPoolAllocator: prohibit copying and assignment The MemoryPoolAllocator implementation cannot and should not be copied (Rule of Three). Declare copy constructor and copy-assignment operator as private. --- include/rapidjson/allocators.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/rapidjson/allocators.h b/include/rapidjson/allocators.h index 6dfa85a..ad5f3cb 100644 --- a/include/rapidjson/allocators.h +++ b/include/rapidjson/allocators.h @@ -187,6 +187,11 @@ public: static void Free(void *ptr) { (void)ptr; } // Do nothing private: + //! Copy constructor is not permitted. + MemoryPoolAllocator(const MemoryPoolAllocator& rhs) /* = delete */; + //! Copy assignment operator is not permitted. + MemoryPoolAllocator& operator=(const MemoryPoolAllocator& rhs) /* = delete */; + //! Creates a new chunk. /*! \param capacity Capacity of the chunk in bytes. */