[libcxx] r187805 - Implement NULL iterators for <forward_list> and <deque> re: N3644

Marshall Clow mclow.lists at gmail.com
Tue Aug 6 09:14:37 PDT 2013


Author: marshall
Date: Tue Aug  6 11:14:36 2013
New Revision: 187805

URL: http://llvm.org/viewvc/llvm-project?rev=187805&view=rev
Log:
Implement NULL iterators for <forward_list> and <deque> re: N3644

Modified:
    libcxx/trunk/include/deque
    libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp
    libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp

Modified: libcxx/trunk/include/deque
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=187805&r1=187804&r2=187805&view=diff
==============================================================================
--- libcxx/trunk/include/deque (original)
+++ libcxx/trunk/include/deque Tue Aug  6 11:14:36 2013
@@ -278,7 +278,11 @@ public:
     typedef random_access_iterator_tag  iterator_category;
     typedef _Reference                  reference;
 
-    _LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+     : __m_iter_(nullptr), __ptr_(nullptr)
+#endif
+     {}
 
     template <class _Pp, class _Rp, class _MP>
     _LIBCPP_INLINE_VISIBILITY

Modified: libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp?rev=187805&r1=187804&r2=187805&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp Tue Aug  6 11:14:36 2013
@@ -44,4 +44,23 @@ int main()
     assert(i == j);
     }
 #endif
+#if _LIBCPP_STD_VER > 11
+    { // N3664 testing
+        std::deque<int>::iterator ii1{}, ii2{};
+        std::deque<int>::iterator ii4 = ii1;
+        std::deque<int>::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+        assert ( ii1 == cii );
+
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+
+//         std::deque<int> c;
+//         assert ( ii1 != c.cbegin());
+//         assert ( cii != c.begin());
+//         assert ( cii != c.cend());
+//         assert ( ii1 != c.end());
+    }
+#endif
 }

Modified: libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp?rev=187805&r1=187804&r2=187805&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp Tue Aug  6 11:14:36 2013
@@ -120,4 +120,23 @@ int main()
         C::const_iterator j;
     }
 #endif
+#if _LIBCPP_STD_VER > 11
+    { // N3664 testing
+        std::forward_list<int>::iterator ii1{}, ii2{};
+        std::forward_list<int>::iterator ii4 = ii1;
+        std::forward_list<int>::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+        assert ( ii1 == cii );
+
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+
+//         std::forward_list<int> c;
+//         assert ( ii1 != c.cbegin());
+//         assert ( cii != c.begin());
+//         assert ( cii != c.cend());
+//         assert ( ii1 != c.end());
+    }
+#endif
 }





More information about the cfe-commits mailing list