Skip to content

Commit

Permalink
add documentation for 'swap' friend functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pah committed Jul 13, 2015
1 parent 46e1696 commit c2b5864
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions include/rapidjson/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,18 @@ class GenericValue {
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.value, b.value);
// ...
}
\endcode
\see Swap()
*/
friend inline void swap(GenericValue& a, GenericValue& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }

//! Prepare Value for move semantics
Expand Down Expand Up @@ -1820,6 +1832,18 @@ class GenericDocument : public GenericValue<Encoding, Allocator> {
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.doc, b.doc);
// ...
}
\endcode
\see Swap()
*/
friend inline void swap(GenericDocument& a, GenericDocument& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }

//!@name Parse from stream
Expand Down

0 comments on commit c2b5864

Please sign in to comment.