[libcxx] r187909 - N3644 support for <string> and <vector>

Marshall Clow mclow.lists at gmail.com
Wed Aug 7 13:48:49 PDT 2013


Author: marshall
Date: Wed Aug  7 15:48:48 2013
New Revision: 187909

URL: http://llvm.org/viewvc/llvm-project?rev=187909&view=rev
Log:
N3644 support for <string> and <vector>

Added:
    libcxx/trunk/test/strings/basic.string/string.iterators/iterators.pass.cpp
Modified:
    libcxx/trunk/include/iterator
    libcxx/trunk/test/containers/sequences/vector/iterators.pass.cpp

Modified: libcxx/trunk/include/iterator
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=187909&r1=187908&r2=187909&view=diff
==============================================================================
--- libcxx/trunk/include/iterator (original)
+++ libcxx/trunk/include/iterator Wed Aug  7 15:48:48 2013
@@ -1093,6 +1093,9 @@ private:
     iterator_type __i;
 public:
     _LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+                : __i{}
+#endif
     {
 #if _LIBCPP_DEBUG_LEVEL >= 2
         __get_db()->__insert_i(this);

Modified: libcxx/trunk/test/containers/sequences/vector/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/vector/iterators.pass.cpp?rev=187909&r1=187908&r2=187909&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/vector/iterators.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/vector/iterators.pass.cpp Wed Aug  7 15:48:48 2013
@@ -135,4 +135,17 @@ int main()
         assert(j->first == 3);
     }
 #endif
+#if _LIBCPP_STD_VER > 11
+    { // N3664 testing
+        typedef std::vector<int> C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+        assert ( ii1 == cii );
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+    }
+#endif
 }

Added: libcxx/trunk/test/strings/basic.string/string.iterators/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/strings/basic.string/string.iterators/iterators.pass.cpp?rev=187909&view=auto
==============================================================================
--- libcxx/trunk/test/strings/basic.string/string.iterators/iterators.pass.cpp (added)
+++ libcxx/trunk/test/strings/basic.string/string.iterators/iterators.pass.cpp Wed Aug  7 15:48:48 2013
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// iterator       begin();
+// iterator       end();
+// const_iterator begin()  const;
+// const_iterator end()    const;
+// const_iterator cbegin() const;
+// const_iterator cend()   const;
+
+#include <string>
+#include <cassert>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+    { // N3664 testing
+        typedef std::string C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+        assert ( ii1 == cii );
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+    }
+
+    { // N3664 testing
+        typedef std::wstring C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );        
+        assert ( ii1 == cii );
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+    }
+
+    { // N3664 testing
+        typedef std::u16string C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+        assert ( ii1 == cii );
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+    }
+
+    { // N3664 testing
+        typedef std::u32string C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+        assert ( ii1 == cii );
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+    }
+#endif
+}





More information about the cfe-commits mailing list