diff options
author | Max Kellermann <max@duempel.org> | 2014-06-23 22:30:01 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-06-23 22:30:01 +0200 |
commit | 7213c267983c37b24ae12f2d188e9ea1bf961b3b (patch) | |
tree | f068c41399724b88bfb4426aa001f7292f946a0c | |
parent | fa1fb47d7553a15f8bde1636364c0e6dba57c39c (diff) | |
download | mpd-7213c267983c37b24ae12f2d188e9ea1bf961b3b.tar.gz mpd-7213c267983c37b24ae12f2d188e9ea1bf961b3b.tar.xz mpd-7213c267983c37b24ae12f2d188e9ea1bf961b3b.zip |
util/ConstBuffer: add method Contains()
Diffstat (limited to '')
-rw-r--r-- | src/util/ConstBuffer.hxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/ConstBuffer.hxx b/src/util/ConstBuffer.hxx index 319102126..db8e64df0 100644 --- a/src/util/ConstBuffer.hxx +++ b/src/util/ConstBuffer.hxx @@ -138,6 +138,16 @@ struct ConstBuffer { return size == 0; } + template<typename U> + gcc_pure + bool Contains(U &&u) const { + for (const auto &i : *this) + if (u == i) + return true; + + return false; + } + constexpr iterator begin() const { return data; } |