Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | // -*- C++ -*- |
|---|---|
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP___CXX03___MEMORY_RAW_STORAGE_ITERATOR_H |
| 11 | #define _LIBCPP___CXX03___MEMORY_RAW_STORAGE_ITERATOR_H |
| 12 | |
| 13 | #include <__cxx03/__config> |
| 14 | #include <__cxx03/__iterator/iterator.h> |
| 15 | #include <__cxx03/__iterator/iterator_traits.h> |
| 16 | #include <__cxx03/__memory/addressof.h> |
| 17 | #include <__cxx03/__utility/move.h> |
| 18 | #include <__cxx03/cstddef> |
| 19 | #include <__cxx03/new> |
| 20 | |
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 22 | # pragma GCC system_header |
| 23 | #endif |
| 24 | |
| 25 | _LIBCPP_PUSH_MACROS |
| 26 | #include <__cxx03/__undef_macros> |
| 27 | |
| 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | |
| 30 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 31 | template <class _OutputIterator, class _Tp> |
| 32 | class _LIBCPP_TEMPLATE_VIS raw_storage_iterator : public iterator<output_iterator_tag, void, void, void, void> { |
| 33 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 34 | |
| 35 | private: |
| 36 | _OutputIterator __x_; |
| 37 | |
| 38 | public: |
| 39 | typedef output_iterator_tag iterator_category; |
| 40 | typedef void value_type; |
| 41 | typedef void difference_type; |
| 42 | typedef void pointer; |
| 43 | typedef void reference; |
| 44 | |
| 45 | _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {} |
| 46 | _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() { return *this; } |
| 47 | _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element) { |
| 48 | ::new ((void*)std::addressof(*__x_)) _Tp(__element); |
| 49 | return *this; |
| 50 | } |
| 51 | _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() { |
| 52 | ++__x_; |
| 53 | return *this; |
| 54 | } |
| 55 | _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int) { |
| 56 | raw_storage_iterator __t(*this); |
| 57 | ++__x_; |
| 58 | return __t; |
| 59 | } |
| 60 | }; |
| 61 | |
| 62 | _LIBCPP_END_NAMESPACE_STD |
| 63 | |
| 64 | _LIBCPP_POP_MACROS |
| 65 | |
| 66 | #endif // _LIBCPP___CXX03___MEMORY_RAW_STORAGE_ITERATOR_H |
| 67 |
Warning: This file is not a C or C++ file. It does not have highlighting.
