File indexing completed on 2026-05-03 08:13:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H
0011 #define _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H
0012
0013 #include <__config>
0014 #include <__cstddef/ptrdiff_t.h>
0015 #include <__iterator/iterator.h>
0016 #include <__iterator/iterator_traits.h>
0017 #include <__memory/addressof.h>
0018 #include <__utility/move.h>
0019
0020 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0021 # pragma GCC system_header
0022 #endif
0023
0024 _LIBCPP_PUSH_MACROS
0025 #include <__undef_macros>
0026
0027 _LIBCPP_BEGIN_NAMESPACE_STD
0028
0029 #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
0030
0031 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0032 template <class _OutputIterator, class _Tp>
0033 class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
0034 # if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
0035 : public iterator<output_iterator_tag, void, void, void, void>
0036 # endif
0037 {
0038 _LIBCPP_SUPPRESS_DEPRECATED_POP
0039
0040 private:
0041 _OutputIterator __x_;
0042
0043 public:
0044 typedef output_iterator_tag iterator_category;
0045 typedef void value_type;
0046 # if _LIBCPP_STD_VER >= 20
0047 typedef ptrdiff_t difference_type;
0048 # else
0049 typedef void difference_type;
0050 # endif
0051 typedef void pointer;
0052 typedef void reference;
0053
0054 _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
0055 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() { return *this; }
0056 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element) {
0057 ::new ((void*)std::addressof(*__x_)) _Tp(__element);
0058 return *this;
0059 }
0060 # if _LIBCPP_STD_VER >= 14
0061 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(_Tp&& __element) {
0062 ::new ((void*)std::addressof(*__x_)) _Tp(std::move(__element));
0063 return *this;
0064 }
0065 # endif
0066 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() {
0067 ++__x_;
0068 return *this;
0069 }
0070 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int) {
0071 raw_storage_iterator __t(*this);
0072 ++__x_;
0073 return __t;
0074 }
0075 # if _LIBCPP_STD_VER >= 14
0076 _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
0077 # endif
0078 };
0079
0080 #endif
0081
0082 _LIBCPP_END_NAMESPACE_STD
0083
0084 _LIBCPP_POP_MACROS
0085
0086 #endif