hidl_string: add operator<
This allows us to std::sort vecs of hidl_strings, etc..
Test: libhidl_test
Change-Id: I6e9a7669bceb09d62791fe8c88cfd1977ea07194
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp
index d657793..ef82775 100644
--- a/base/HidlSupport.cpp
+++ b/base/HidlSupport.cpp
@@ -90,6 +90,10 @@
return *this;
}
+bool hidl_string::operator< (const hidl_string &rhs) const {
+ return strcmp(mBuffer, rhs.mBuffer) < 0;
+}
+
hidl_string::operator std::string() const {
return std::string(mBuffer, mSize);
}