diff options
author | miloyip <miloyip@gmail.com> | 2015-05-17 17:20:56 +0300 |
---|---|---|
committer | miloyip <miloyip@gmail.com> | 2015-05-17 17:20:56 +0300 |
commit | e20645f0d1f1af002dd5ec74d904d308085cd8b2 (patch) | |
tree | 89305cf6d7321c6a1e016749d8fcd19a7b0a274c /include/rapidjson/pointer.h | |
parent | a4cbd3f81b0a520bdc007afe96ecda6cd471fb47 (diff) |
Add optional allocator for Pointer default/copy constructor
Diffstat (limited to 'include/rapidjson/pointer.h')
-rw-r--r-- | include/rapidjson/pointer.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/rapidjson/pointer.h b/include/rapidjson/pointer.h index 13e688e9..a1411e9f 100644 --- a/include/rapidjson/pointer.h +++ b/include/rapidjson/pointer.h @@ -96,7 +96,7 @@ public: //@{ //! Default constructor. - GenericPointer() : allocator_(), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {} + GenericPointer(Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {} //! Constructor that parses a string or URI fragment representation. /*! @@ -155,7 +155,7 @@ 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_(), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { + GenericPointer(const GenericPointer& rhs, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { *this = rhs; } @@ -299,6 +299,9 @@ public: //@} + //! Get the allocator of this pointer. + Allocator& GetAllocator() { return *allocator_; } + //!@name Tokens //@{ |