aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/ConstBuffer.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-06-23 22:30:01 +0200
committerMax Kellermann <max@duempel.org>2014-06-23 22:30:01 +0200
commit7213c267983c37b24ae12f2d188e9ea1bf961b3b (patch)
treef068c41399724b88bfb4426aa001f7292f946a0c /src/util/ConstBuffer.hxx
parentfa1fb47d7553a15f8bde1636364c0e6dba57c39c (diff)
downloadmpd-7213c267983c37b24ae12f2d188e9ea1bf961b3b.tar.gz
mpd-7213c267983c37b24ae12f2d188e9ea1bf961b3b.tar.xz
mpd-7213c267983c37b24ae12f2d188e9ea1bf961b3b.zip
util/ConstBuffer: add method Contains()
Diffstat (limited to 'src/util/ConstBuffer.hxx')
-rw-r--r--src/util/ConstBuffer.hxx10
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;
}