[libc++] Split std::raw_storage_iterator out of <memory>

Differential Revision: https://reviews.llvm.org/D100318

GitOrigin-RevId: be54341cd2ffc970391b637de90aa05b134d9e89
diff --git a/include/memory b/include/memory
index fcfc10b..01cbced 100644
--- a/include/memory
+++ b/include/memory
@@ -685,6 +685,7 @@
 #include <__memory/base.h>
 #include <__memory/compressed_pair.h>
 #include <__memory/pointer_traits.h>
+#include <__memory/raw_storage_iterator.h>
 #include <__memory/temporary_buffer.h>
 #include <__memory/utilities.h>
 #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
@@ -813,33 +814,6 @@
         _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
 }
 
-template <class _OutputIterator, class _Tp>
-class _LIBCPP_TEMPLATE_VIS raw_storage_iterator
-    : public iterator<output_iterator_tag,
-                      _Tp,                                         // purposefully not C++03
-                      ptrdiff_t,                                   // purposefully not C++03
-                      _Tp*,                                        // purposefully not C++03
-                      raw_storage_iterator<_OutputIterator, _Tp>&> // purposefully not C++03
-{
-private:
-    _OutputIterator __x_;
-public:
-    _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
-    _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
-    _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
-        {::new ((void*)_VSTD::addressof(*__x_)) _Tp(__element); return *this;}
-#if _LIBCPP_STD_VER >= 14
-    _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
-        {::new ((void*)_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;}
-#endif
-    _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
-};
-
 // default_delete
 
 template <class _Tp>