[PATCH] Proposed Resolution for LWG Issue #2454: Add raw_storage_iterator::base() member

Marshall Clow mclow.lists at gmail.com
Thu Apr 30 11:48:07 PDT 2015


Hi EricWF,

http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2454

http://reviews.llvm.org/D9412

Files:
  include/memory
  test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp

Index: include/memory
===================================================================
--- include/memory
+++ include/memory
@@ -1855,6 +1855,9 @@
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator  operator++(int)
         {raw_storage_iterator __t(*this); ++__x_; return __t;}
+#if _LIBCPP_STD_VER >= 14
+    _LIBCPP_INLINE_VISIBILITY _OutputIterator base() const { return __x_; } 
+#endif
 };
 
 template <class _Tp>
Index: test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
===================================================================
--- test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
+++ test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
@@ -34,11 +34,17 @@
     Storage buffer;
     std::raw_storage_iterator<A*, A> it((A*)&buffer);
     assert(A_constructed == 0);
+#if __cplusplus >= 201402L
+    assert(it.base() == (A*)&buffer);
+#endif
     for (int i = 0; i < 3; ++i)
     {
         *it++ = A(i+1);
         A* ap = (A*)&buffer + i;
         assert(*ap == i+1);
         assert(A_constructed == i+1);
+#if __cplusplus >= 201402L
+        assert(it.base() == ap + 1);  // next place to write
+#endif
     }
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9412.24760.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150430/74af0516/attachment.bin>


More information about the cfe-commits mailing list