Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Yip <miloyip@gmail.com>2018-12-18 04:32:09 +0300
committerGitHub <noreply@github.com>2018-12-18 04:32:09 +0300
commitb56eb28575626104922d77f6d74a116c5dbd611e (patch)
treeb9df54d9d4138254a835554098161434fe0c7962 /include/rapidjson/pointer.h
parenteb6ee17d2dcc596806875b2167cf8bf54f37e425 (diff)
parent8549e3db6a3cdecf4f8cdb9ee9f49d49e6320dc1 (diff)
Merge branch 'master' into pointer_less_than
Diffstat (limited to 'include/rapidjson/pointer.h')
-rw-r--r--include/rapidjson/pointer.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/rapidjson/pointer.h b/include/rapidjson/pointer.h
index 51805a63..063abab9 100644
--- a/include/rapidjson/pointer.h
+++ b/include/rapidjson/pointer.h
@@ -200,6 +200,36 @@ public:
return *this;
}
+ //! Swap the content of this pointer with an other.
+ /*!
+ \param other The pointer to swap with.
+ \note Constant complexity.
+ */
+ GenericPointer& Swap(GenericPointer& other) RAPIDJSON_NOEXCEPT {
+ internal::Swap(allocator_, other.allocator_);
+ internal::Swap(ownAllocator_, other.ownAllocator_);
+ internal::Swap(nameBuffer_, other.nameBuffer_);
+ internal::Swap(tokens_, other.tokens_);
+ internal::Swap(tokenCount_, other.tokenCount_);
+ internal::Swap(parseErrorOffset_, other.parseErrorOffset_);
+ internal::Swap(parseErrorCode_, other.parseErrorCode_);
+ return *this;
+ }
+
+ //! free-standing swap function helper
+ /*!
+ Helper function to enable support for common swap implementation pattern based on \c std::swap:
+ \code
+ void swap(MyClass& a, MyClass& b) {
+ using std::swap;
+ swap(a.pointer, b.pointer);
+ // ...
+ }
+ \endcode
+ \see Swap()
+ */
+ friend inline void swap(GenericPointer& a, GenericPointer& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }
+
//@}
//!@name Append token