https://bugs.webkit.org/show_bug.cgi?id=190953
Reviewed by Chris Dumez.
Source/WTF:
* wtf/HashSet.h:
Remove non-const random(). HashSet only returns const iterators (it is immutable via iterator).
* wtf/HashTable.h:
(WTF::HashTable::random const):
Invoke const_iterator() by using static_cast<> instead of trying to do it directly.
Tools:
* TestWebKitAPI/Tests/WTF/HashSet.cpp:
(TestWebKitAPI::TEST):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237461
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-10-26 Antti Koivisto <antti@apple.com>
+
+ hashSet.remove(hashSet.random()) doesn't build
+ https://bugs.webkit.org/show_bug.cgi?id=190953
+
+ Reviewed by Chris Dumez.
+
+ * wtf/HashSet.h:
+
+ Remove non-const random(). HashSet only returns const iterators (it is immutable via iterator).
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::random const):
+
+ Invoke const_iterator() by using static_cast<> instead of trying to do it directly.
+
2018-10-26 Alicia Boya GarcĂa <aboya@igalia.com>
[MSE][WTF][Media] Invalid MediaTime should be falsy
iterator begin() const;
iterator end() const;
- iterator random() { return m_impl.random(); }
- const_iterator random() const { return m_impl.random(); }
+ iterator random() const { return m_impl.random(); }
iterator find(const ValueType&) const;
bool contains(const ValueType&) const;
return it;
}
- const_iterator random() const { return const_cast<HashTable*>(this)->random().const_iterator(); }
+ const_iterator random() const { return static_cast<const_iterator>(const_cast<HashTable*>(this)->random()); }
unsigned size() const { return m_keyCount; }
unsigned capacity() const { return m_tableSize; }
+2018-10-26 Antti Koivisto <antti@apple.com>
+
+ hashSet.remove(hashSet.random()) doesn't build
+ https://bugs.webkit.org/show_bug.cgi?id=190953
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/Tests/WTF/HashSet.cpp:
+ (TestWebKitAPI::TEST):
+
2018-10-26 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] Layout floats as part of the inline content
set1.remove(10);
}
+TEST(WTF_HashSet, RemoveRandom)
+{
+ HashSet<unsigned> set1 { 1, 2, 3 };
+ set1.remove(set1.random());
+ set1.remove(set1.random());
+ set1.remove(set1.random());
+ ASSERT_TRUE(set1.isEmpty());
+}
+
} // namespace TestWebKitAPI