Add default operator== to serializable classes
Otherwise derived classes cannot use add a default themselves. Maybe this makes sense for more comparision operators. Note that I'm still testing the usefulness. It already breaks when using multiple inheritane so maybe there is a better way. The operator is guarded by a version constraint because it is a C++20 feature.
This commit is contained in:
parent
60d761f7ed
commit
5c7a6cba8c
|
@ -27,6 +27,10 @@ template <typename Type, BinaryVersion v> struct BinarySerializable {
|
||||||
|
|
||||||
static constexpr const char *qualifiedName = "ReflectiveRapidJSON::BinarySerializable";
|
static constexpr const char *qualifiedName = "ReflectiveRapidJSON::BinarySerializable";
|
||||||
static constexpr auto version = v;
|
static constexpr auto version = v;
|
||||||
|
|
||||||
|
#if __cplusplus > 201707L
|
||||||
|
bool operator==(const BinarySerializable<Type, v> &) const = default;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Type, BinaryVersion v> inline void BinarySerializable<Type, v>::toBinary(std::ostream &outputStream, BinaryVersion version) const
|
template <typename Type, BinaryVersion v> inline void BinarySerializable<Type, v>::toBinary(std::ostream &outputStream, BinaryVersion version) const
|
||||||
|
|
|
@ -31,6 +31,10 @@ template <typename Type> struct JsonSerializable {
|
||||||
static Type fromJson(const std::string &json, JsonDeserializationErrors *errors = nullptr);
|
static Type fromJson(const std::string &json, JsonDeserializationErrors *errors = nullptr);
|
||||||
|
|
||||||
static constexpr const char *qualifiedName = "ReflectiveRapidJSON::JsonSerializable";
|
static constexpr const char *qualifiedName = "ReflectiveRapidJSON::JsonSerializable";
|
||||||
|
|
||||||
|
#if __cplusplus > 201707L
|
||||||
|
bool operator==(const JsonSerializable<Type> &) const = default;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Reference in New Issue