Title: [247767] trunk/Source/WTF
Revision
247767
Author
[email protected]
Date
2019-07-23 21:29:14 -0700 (Tue, 23 Jul 2019)

Log Message

Add cheat sheet comment for HashMap/Set iterator/AddResult
https://bugs.webkit.org/show_bug.cgi?id=200061

Reviewed by Saam Barati.

* wtf/HashMap.h:
* wtf/HashSet.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (247766 => 247767)


--- trunk/Source/WTF/ChangeLog	2019-07-24 04:29:09 UTC (rev 247766)
+++ trunk/Source/WTF/ChangeLog	2019-07-24 04:29:14 UTC (rev 247767)
@@ -1,3 +1,13 @@
+2019-07-23  Keith Miller  <[email protected]>
+
+        Add cheat sheet comment for HashMap/Set iterator/AddResult
+        https://bugs.webkit.org/show_bug.cgi?id=200061
+
+        Reviewed by Saam Barati.
+
+        * wtf/HashMap.h:
+        * wtf/HashSet.h:
+
 2019-07-23  Keith Rollin  <[email protected]>
 
         Remove rest of NavigatorContentUtils support

Modified: trunk/Source/WTF/wtf/HashMap.h (247766 => 247767)


--- trunk/Source/WTF/wtf/HashMap.h	2019-07-24 04:29:09 UTC (rev 247766)
+++ trunk/Source/WTF/wtf/HashMap.h	2019-07-24 04:29:14 UTC (rev 247767)
@@ -65,6 +65,11 @@
     using IdentityTranslatorType = typename HashTableType::IdentityTranslatorType;
 
 public:
+    /*
+     * Since figuring out the entries of an iterator is confusing, here is a cheat sheet:
+     * const KeyType& key = iterator->key;
+     * ValueType& value = iterator->value;
+     */
     using iterator = HashTableIteratorAdapter<HashTableType, KeyValuePairType>;
     using const_iterator = HashTableConstIteratorAdapter<HashTableType, KeyValuePairType>;
 
@@ -73,6 +78,11 @@
     using ValuesIteratorRange = SizedIteratorRange<HashMap, typename iterator::Values>;
     using ValuesConstIteratorRange = SizedIteratorRange<HashMap, typename const_iterator::Values>;
 
+    /*
+     * Since figuring out the entries of an AddResult is confusing, here is a cheat sheet:
+     * iterator iter = addResult.iterator;
+     * bool isNewEntry = addResult.isNewEntry;
+     */
     using AddResult = typename HashTableType::AddResult;
 
 public:

Modified: trunk/Source/WTF/wtf/HashSet.h (247766 => 247767)


--- trunk/Source/WTF/wtf/HashSet.h	2019-07-24 04:29:09 UTC (rev 247766)
+++ trunk/Source/WTF/wtf/HashSet.h	2019-07-24 04:29:14 UTC (rev 247767)
@@ -45,8 +45,18 @@
         HashFunctions, ValueTraits, ValueTraits> HashTableType;
 
 public:
+    /*
+     * Since figuring out the entries of an iterator is confusing, here is a cheat sheet:
+     * const KeyType& key = iterator->key;
+     */
     typedef HashTableConstIteratorAdapter<HashTableType, ValueType> iterator;
     typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
+
+    /*
+     * Since figuring out the entries of an AddResult is confusing, here is a cheat sheet:
+     * iterator iter = addResult.iterator;
+     * bool isNewEntry = addResult.isNewEntry;
+     */
     typedef typename HashTableType::AddResult AddResult;
 
     HashSet()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to