diff options
author | Étienne Dupuis <svart.riddare@gmail.com> | 2017-11-23 11:16:20 +0300 |
---|---|---|
committer | Étienne Dupuis <svart.riddare@gmail.com> | 2017-11-23 11:16:20 +0300 |
commit | 86e280f636b3578ea44171dc144dea7f234644f1 (patch) | |
tree | 98b6947e85bd226d8a60eed82883b372e7c73c75 /include/rapidjson/pointer.h | |
parent | 2a0bc6062b38ed40586bd8e1945835698b95a9c1 (diff) |
Solves #1108. The default copy constructor of GenericPointer will use the allocator of the copied object. The extra copy constructor that takes an allocator as a parameter is distinct if someone really wants to create a copy with a null allocator.
Diffstat (limited to 'include/rapidjson/pointer.h')
-rw-r--r-- | include/rapidjson/pointer.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/rapidjson/pointer.h b/include/rapidjson/pointer.h index 0f377efe..217e71ce 100644 --- a/include/rapidjson/pointer.h +++ b/include/rapidjson/pointer.h @@ -165,7 +165,12 @@ public: GenericPointer(const Token* tokens, size_t tokenCount) : allocator_(), ownAllocator_(), nameBuffer_(), tokens_(const_cast<Token*>(tokens)), tokenCount_(tokenCount), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {} //! Copy constructor. - GenericPointer(const GenericPointer& rhs, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { + GenericPointer(const GenericPointer& rhs) : allocator_(rhs.allocator_), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { + *this = rhs; + } + + //! Copy constructor. + GenericPointer(const GenericPointer& rhs, Allocator* allocator) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { *this = rhs; } |