From d252ecd131a348a9ba449548b59a2b853af68dde Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 18 Apr 2022 12:58:39 +0200 Subject: [PATCH] Added contains method to PoolVector. --- core/pool_vector.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/pool_vector.h b/core/pool_vector.h index eeac1d5e1..7536321e8 100644 --- a/core/pool_vector.h +++ b/core/pool_vector.h @@ -441,6 +441,19 @@ public: return rs; } + bool contains(const T &val) const { + Read r = read(); + int s = size(); + + for (int i = 0; i < s; ++s) { + if (r[i] == val) { + return true; + } + } + + return false; + } + bool is_locked() const { return alloc && alloc->lock.get() > 0; } inline T operator[](int p_index) const;