tags:

views:

67

answers:

2

I want to compare two *Message*s or (two sub parameters) of Google protocol buffers. I don't find an API do achieve it.

Any ideas?

+1  A: 

This might not be the ideal solution, but I think it could be done by:

messageA.DebugString() == messageB.DebugString();

Other than that, I think the only solution would be to create your own Message child class and implement a bool operator==(const Message&).

Gianni
+1 nice try :) Actually I need it be fast
dimba
@idimba Tks. But then I guess you should edit your question and mention the speed thing ;-). But then, I guess, the only real option would be to implement the comparison operator yourself.
Gianni
A: 

Well, a protocol buffer is just a serialization format for some object type. Why not use the protocol buffer to reconstruct the original objects, and then allow those objects to compare themselves, using whatever comparison logic you've built into the class?

benjismith