I'm new to the concept of protocol buffers and have a task at hand that can be resolved if I use the protobuf object as keys in the std::map
.
I know to be able to use protobuf object as key, I need to provide a custom comparator to the std::map
to maintain the ordering of the keys.
I have two questions at this point in time:
- Is there any utility function/class in the google/protobuf/util that overloads less than operator for comparing two protobuf messages? i.e., something similar to this.
bool operator<(google::protobuf::Message m1, google::protobuf::Message m2){
// compare the protobuf messages
// and finally return the value
return value;
}
- Any potential side effects that I might be aware of, which might arise as a result of using a protobuf object as key?