Skip to content
Snippets Groups Projects
Verified Commit 9b0c5988 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Fix operator==

parent 685c2fdd
No related branches found
No related tags found
1 merge request!25F cpp to string
Pipeline #13962 passed
Pipeline: caosdb-cppinttest

#13963

    ...@@ -58,16 +58,24 @@ public: ...@@ -58,16 +58,24 @@ public:
    * serialization. * serialization.
    */ */
    inline auto operator==(const ProtoMessageWrapper<P> &other) const noexcept -> bool { inline auto operator==(const ProtoMessageWrapper<P> &other) const noexcept -> bool {
    if (this->wrapped != nullptr && other.wrapped != nullptr) {
    return this->wrapped->SerializeAsString() == other.wrapped->SerializeAsString(); return this->wrapped->SerializeAsString() == other.wrapped->SerializeAsString();
    } }
    // both nullptr?
    return this->wrapped == other.wrapped;
    }
    /** /**
    * Return true if the underlying Protobuf messages have a different * Return true if the underlying Protobuf messages have a different
    * serialization. * serialization.
    */ */
    inline auto operator!=(const ProtoMessageWrapper<P> &other) const noexcept -> bool { inline auto operator!=(const ProtoMessageWrapper<P> &other) const noexcept -> bool {
    if (this->wrapped != nullptr && other.wrapped != nullptr) {
    return this->wrapped->SerializeAsString() != other.wrapped->SerializeAsString(); return this->wrapped->SerializeAsString() != other.wrapped->SerializeAsString();
    } }
    // only one is nullptr?
    return this->wrapped != other.wrapped;
    }
    protected: protected:
    inline static auto CopyProtoMessage(P *wrapped) -> P * { inline static auto CopyProtoMessage(P *wrapped) -> P * {
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment