diff options
author | Tomasz Wasilczyk <twasilczyk@google.com> | 2019-07-16 08:44:15 -0700 |
---|---|---|
committer | Tomasz Wasilczyk <twasilczyk@google.com> | 2019-07-23 16:55:10 -0700 |
commit | 93f75928d41841e6a8b771442aaa27ba67095471 (patch) | |
tree | 3720881a8a2746513b0e612f6d62f860d8b75583 /base | |
parent | 30b01fdf5e580c1301bfa2f320441d8c75203c72 (diff) | |
download | libhidl-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.h | 5 |
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; |