summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorTomasz Wasilczyk <twasilczyk@google.com>2019-07-16 08:44:15 -0700
committerTomasz Wasilczyk <twasilczyk@google.com>2019-07-23 16:55:10 -0700
commit93f75928d41841e6a8b771442aaa27ba67095471 (patch)
tree3720881a8a2746513b0e612f6d62f860d8b75583 /base
parent30b01fdf5e580c1301bfa2f320441d8c75203c72 (diff)
downloadlibhidl-93f75928d41841e6a8b771442aaa27ba67095471.tar.gz
Implement hidl_vec::find and hidl_vec::contains
Also fixed formatting of nearby line. Bug: 135918744 Test: atest libhidl_test Change-Id: I3743115bdacdbf56b6e68d57cf7a8f38f99cb182
Diffstat (limited to 'base')
-rw-r--r--base/include/hidl/HidlSupport.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index 44691e6..056f177 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -569,8 +569,11 @@ public:
iterator end() { return data()+mSize; }
const_iterator begin() const { return data(); }
const_iterator end() const { return data()+mSize; }
+ iterator find(const T& v) { return std::find(begin(), end(), v); }
+ const_iterator find(const T& v) const { return std::find(begin(), end(), v); }
+ bool contains(const T& v) const { return find(v) != end(); }
-private:
+ private:
details::hidl_pointer<T> mBuffer;
uint32_t mSize;
bool mOwnsBuffer;