summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf/Vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/wtf/Vector.h')
-rw-r--r--JavaScriptCore/wtf/Vector.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/JavaScriptCore/wtf/Vector.h b/JavaScriptCore/wtf/Vector.h
index c833eeb..c60de15 100644
--- a/JavaScriptCore/wtf/Vector.h
+++ b/JavaScriptCore/wtf/Vector.h
@@ -557,6 +557,7 @@ namespace WTF {
const T& last() const { return at(size() - 1); }
template<typename U> size_t find(const U&) const;
+ template<typename U> size_t reverseFind(const U&) const;
void shrink(size_t size);
void grow(size_t size);
@@ -744,6 +745,18 @@ namespace WTF {
}
template<typename T, size_t inlineCapacity>
+ template<typename U>
+ size_t Vector<T, inlineCapacity>::reverseFind(const U& value) const
+ {
+ for (size_t i = 1; i <= size(); ++i) {
+ const size_t index = size() - i;
+ if (at(index) == value)
+ return index;
+ }
+ return notFound;
+ }
+
+ template<typename T, size_t inlineCapacity>
void Vector<T, inlineCapacity>::fill(const T& val, size_t newSize)
{
if (size() > newSize)