Remove usages of std::iterator
authorAlan Zhao <ayzhao@google.com>
Thu, 19 May 2022 18:54:48 +0000 (14:54 -0400)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 2 Jun 2022 22:39:20 +0000 (22:39 +0000)
std::iterator is deprecated in C++17, and its presence is blocking
Chromium from updating libc++ (https://crbug.com/1273285).

Components: Framework
VK-GL-CTS Issue: 3703

Change-Id: I4f8a50a3d0fc09b20c7f94807902770beb09d295

framework/common/tcuRandomValueIterator.hpp
framework/opengl/gluVarTypeUtil.hpp
framework/randomshaders/rsgVariableManager.hpp

index 834b8bf..4084917 100644 (file)
@@ -55,9 +55,15 @@ template <> inline deInt32   getRandomValue<deInt32>         (de::Random& rnd) { return (
 template <> inline deInt64     getRandomValue<deInt64>         (de::Random& rnd) { return (deInt64)rnd.getUint64();    }
 
 template <typename T>
-class RandomValueIterator : public std::iterator<std::forward_iterator_tag, T>
+class RandomValueIterator
 {
 public:
+       using iterator_category = std::forward_iterator_tag;
+       using value_type = T;
+       using difference_type = std::ptrdiff_t;
+       using pointer = T*;
+       using reference = T&;
+
        static RandomValueIterator      begin                                   (deUint32 seed, int numValues)  { return RandomValueIterator<T>(seed, numValues);       }
        static RandomValueIterator      end                                             (void)                                                  { return RandomValueIterator<T>(0, 0);                          }
 
index e969524..ee9b70c 100644 (file)
@@ -157,9 +157,15 @@ private:
 
 // \note VarType must be live during iterator usage.
 template <class IsExpanded>
-class SubTypeIterator : public std::iterator<std::forward_iterator_tag, VarType>
+class SubTypeIterator
 {
 public:
+       using iterator_category = std::forward_iterator_tag;
+       using value_type = VarType;
+       using difference_type = std::ptrdiff_t;
+       using pointer = VarType*;
+       using reference = VarType&;
+
        static SubTypeIterator<IsExpanded>      begin                           (const VarType* type) { return SubTypeIterator(type);                                           }
        static SubTypeIterator<IsExpanded>      end                                     (const VarType* type) { DE_UNREF(type); return SubTypeIterator(DE_NULL);        }
 
index 208cdb4..d61087f 100644 (file)
@@ -116,9 +116,15 @@ public:
 
 // \todo [2011-05-26 pyry] Clean up this a bit, separate const variant.
 template <typename Item, typename Iterator, class Filter>
-class FilteredIterator : public std::iterator<std::input_iterator_tag, Item>
+class FilteredIterator
 {
 public:
+       using iterator_category = std::input_iterator_tag;
+       using value_type = Item;
+       using difference_type = std::ptrdiff_t;
+       using pointer = Item*;
+       using reference = Item&;
+
        FilteredIterator (Iterator iter, Iterator end, Filter filter)
                : m_iter        (iter)
                , m_end         (end)