Disable copy constructor in GenericMember
This commit is contained in:
parent
6006d6b678
commit
c36b713c47
@ -63,15 +63,39 @@ class GenericDocument;
|
|||||||
https://code.google.com/p/rapidjson/issues/detail?id=64
|
https://code.google.com/p/rapidjson/issues/detail?id=64
|
||||||
*/
|
*/
|
||||||
template <typename Encoding, typename Allocator>
|
template <typename Encoding, typename Allocator>
|
||||||
struct GenericMember {
|
class GenericMember {
|
||||||
|
public:
|
||||||
GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
|
GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
|
||||||
GenericValue<Encoding, Allocator> value; //!< value of member.
|
GenericValue<Encoding, Allocator> value; //!< value of member.
|
||||||
|
|
||||||
|
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
|
||||||
|
//! Move constructor in C++11
|
||||||
|
GenericMember(GenericMember&& rhs) RAPIDJSON_NOEXCEPT = default;
|
||||||
|
|
||||||
|
//! Move assignment in C++11
|
||||||
|
GenericMember& operator=(GenericMember&& rhs) RAPIDJSON_NOEXCEPT = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//! Assignment with move semantics.
|
||||||
|
/*! \param rhs Source of the assignment. Its name and value will become a null value after assignment.
|
||||||
|
*/
|
||||||
|
GenericMember& operator=(GenericMember& rhs) RAPIDJSON_NOEXCEPT {
|
||||||
|
if (RAPIDJSON_LIKELY(this != &rhs)) {
|
||||||
|
name = rhs.name;
|
||||||
|
value = rhs.value;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// swap() for std::sort() and other potential use in STL.
|
// swap() for std::sort() and other potential use in STL.
|
||||||
friend inline void swap(GenericMember& a, GenericMember& b) RAPIDJSON_NOEXCEPT {
|
friend inline void swap(GenericMember& a, GenericMember& b) RAPIDJSON_NOEXCEPT {
|
||||||
a.name.Swap(b.name);
|
a.name.Swap(b.name);
|
||||||
a.value.Swap(b.value);
|
a.value.Swap(b.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Copy constructor is not permitted.
|
||||||
|
GenericMember(const GenericMember& rhs);
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -102,7 +102,7 @@ class PrettyWriter;
|
|||||||
// document.h
|
// document.h
|
||||||
|
|
||||||
template <typename Encoding, typename Allocator>
|
template <typename Encoding, typename Allocator>
|
||||||
struct GenericMember;
|
class GenericMember;
|
||||||
|
|
||||||
template <bool Const, typename Encoding, typename Allocator>
|
template <bool Const, typename Encoding, typename Allocator>
|
||||||
class GenericMemberIterator;
|
class GenericMemberIterator;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user