Title: [164190] trunk/Source/WTF
Revision
164190
Author
[email protected]
Date
2014-02-16 01:11:44 -0800 (Sun, 16 Feb 2014)

Log Message

Reintroduce const qualifiers for return types of (Filter|Transform)Iterator::operator*()
https://bugs.webkit.org/show_bug.cgi?id=126875

The const qualifiers for the return types of FilterIterator::operator*() and TransformIterator::operator*()
were removed in r161797 and r161802 because of compilation failures when using GCC and having an Iterator
type that already had the const qualifier. std::remove_const is now used to appease GCC and enforce the const
qualifier on the return type, regardless of the Iterator type and its qualifiers.

* wtf/IteratorAdaptors.h:
(WTF::FilterIterator::operator*):
(WTF::TransformIterator::operator*):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (164189 => 164190)


--- trunk/Source/WTF/ChangeLog	2014-02-16 05:07:57 UTC (rev 164189)
+++ trunk/Source/WTF/ChangeLog	2014-02-16 09:11:44 UTC (rev 164190)
@@ -1,3 +1,17 @@
+2014-02-16  Zan Dobersek  <[email protected]>
+
+        Reintroduce const qualifiers for return types of (Filter|Transform)Iterator::operator*()
+        https://bugs.webkit.org/show_bug.cgi?id=126875
+
+        The const qualifiers for the return types of FilterIterator::operator*() and TransformIterator::operator*()
+        were removed in r161797 and r161802 because of compilation failures when using GCC and having an Iterator
+        type that already had the const qualifier. std::remove_const is now used to appease GCC and enforce the const
+        qualifier on the return type, regardless of the Iterator type and its qualifiers.
+
+        * wtf/IteratorAdaptors.h:
+        (WTF::FilterIterator::operator*):
+        (WTF::TransformIterator::operator*):
+
 2014-02-15  Filip Pizlo  <[email protected]>
 
         Vector with inline capacity should work with non-PODs

Modified: trunk/Source/WTF/wtf/IteratorAdaptors.h (164189 => 164190)


--- trunk/Source/WTF/wtf/IteratorAdaptors.h	2014-02-16 05:07:57 UTC (rev 164189)
+++ trunk/Source/WTF/wtf/IteratorAdaptors.h	2014-02-16 09:11:44 UTC (rev 164190)
@@ -26,6 +26,8 @@
 #ifndef WTF_IteratorAdaptors_h
 #define WTF_IteratorAdaptors_h
 
+#include <type_traits>
+
 namespace WTF {
 
 template<typename Predicate, typename Iterator>
@@ -50,7 +52,7 @@
         return *this;
     }
 
-    decltype(*std::declval<Iterator>()) operator*() const
+    const typename std::remove_const<decltype(*std::declval<Iterator>())>::type operator*() const
     {
         ASSERT(m_iter != m_end);
         ASSERT(m_pred(*m_iter));
@@ -87,7 +89,7 @@
         return *this;
     }
 
-    decltype(std::declval<Transform>()(*std::declval<Iterator>())) operator*() const
+    const typename std::remove_const<decltype(std::declval<Transform>()(*std::declval<Iterator>()))>::type operator*() const
     {
         return m_transform(*m_iter);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to