[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __memory / raw_storage_iterator.h
blob2ee4c074d8d33786026473f4b9cbc8a76e75e6fa
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 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H
11 #define _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H
13 #include <__config>
14 #include <__cstddef/ptrdiff_t.h>
15 #include <__iterator/iterator.h>
16 #include <__iterator/iterator_traits.h>
17 #include <__memory/addressof.h>
18 #include <__utility/move.h>
19 #include <new>
21 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22 # pragma GCC system_header
23 #endif
25 _LIBCPP_PUSH_MACROS
26 #include <__undef_macros>
28 _LIBCPP_BEGIN_NAMESPACE_STD
30 #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
32 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
33 template <class _OutputIterator, class _Tp>
34 class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
35 # if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
36 : public iterator<output_iterator_tag, void, void, void, void>
37 # endif
39 _LIBCPP_SUPPRESS_DEPRECATED_POP
41 private:
42 _OutputIterator __x_;
44 public:
45 typedef output_iterator_tag iterator_category;
46 typedef void value_type;
47 # if _LIBCPP_STD_VER >= 20
48 typedef ptrdiff_t difference_type;
49 # else
50 typedef void difference_type;
51 # endif
52 typedef void pointer;
53 typedef void reference;
55 _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
56 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() { return *this; }
57 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element) {
58 ::new ((void*)std::addressof(*__x_)) _Tp(__element);
59 return *this;
61 # if _LIBCPP_STD_VER >= 14
62 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(_Tp&& __element) {
63 ::new ((void*)std::addressof(*__x_)) _Tp(std::move(__element));
64 return *this;
66 # endif
67 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() {
68 ++__x_;
69 return *this;
71 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int) {
72 raw_storage_iterator __t(*this);
73 ++__x_;
74 return __t;
76 # if _LIBCPP_STD_VER >= 14
77 _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
78 # endif
81 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
83 _LIBCPP_END_NAMESPACE_STD
85 _LIBCPP_POP_MACROS
87 #endif // _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H