util/ConstBuffer: add method Contains()

This commit is contained in:
Max Kellermann 2014-06-23 22:30:01 +02:00
parent fa1fb47d75
commit 7213c26798

View File

@ -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;
}