Adding swap() for GenericMember
This commit is contained in:
parent
0739a3e88b
commit
b94c2a1203
@ -17,10 +17,7 @@ static void printIt(const Value &doc) {
|
||||
}
|
||||
|
||||
struct NameComparator {
|
||||
bool operator()(
|
||||
const GenericMember<UTF8<>, MemoryPoolAllocator<> > &lhs,
|
||||
const GenericMember<UTF8<>, MemoryPoolAllocator<> > &rhs) const
|
||||
{
|
||||
bool operator()(const Value::Member &lhs, const Value::Member &rhs) const {
|
||||
return (strcmp(lhs.name.GetString(), rhs.name.GetString()) < 0);
|
||||
}
|
||||
};
|
||||
|
@ -66,6 +66,12 @@ template <typename Encoding, typename Allocator>
|
||||
struct GenericMember {
|
||||
GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
|
||||
GenericValue<Encoding, Allocator> value; //!< value of member.
|
||||
|
||||
// swap() for std::sort() and other potential use in STL.
|
||||
friend inline void swap(GenericMember& a, GenericMember& b) RAPIDJSON_NOEXCEPT {
|
||||
a.name.Swap(b.name);
|
||||
a.value.Swap(b.value);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user