[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / include / experimental / iterator
blobe9c1fb6924ecedab38e16cc234142bb8269ed30d
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_EXPERIMENTAL_ITERATOR
11 #define _LIBCPP_EXPERIMENTAL_ITERATOR
14 namespace std {
15   namespace experimental {
16     inline namespace fundamentals_v2 {
18     template <class DelimT, class charT = char, class traits = char_traits<charT>>
19         class ostream_joiner {
20         public:
21          typedef charT                        char_type;
22          typedef traits                       traits_type;
23          typedef basic_ostream<charT, traits> ostream_type;
24          typedef output_iterator_tag          iterator_category;
25          typedef void                         value_type;
26          typedef void                         difference_type;
27          typedef void                         pointer;
28          typedef void                         reference;
30          ostream_joiner(ostream_type& s, const DelimT& delimiter);
31          ostream_joiner(ostream_type& s, DelimT&& delimiter);
33          template<typename T>
34          ostream_joiner& operator=(const T& value);
36          ostream_joiner& operator*() noexcept;
37          ostream_joiner& operator++() noexcept;
38          ostream_joiner& operator++(int) noexcept;
39    private:
40       ostream_type* out_stream;   // exposition only
41       DelimT delim;               // exposition only
42       bool first_element;         // exposition only
43    };
45   template <class charT, class traits, class DelimT>
46     ostream_joiner<decay_t<DelimT>, charT, traits>
47     make_ostream_joiner(basic_ostream<charT, traits>& os, DelimT&& delimiter);
49     } // inline namespace fundamentals_v2
50   } // namespace experimental
51 } // namespace std
55 #include <__assert> // all public C++ headers provide the assertion handler
56 #include <__memory/addressof.h>
57 #include <__type_traits/decay.h>
58 #include <__utility/forward.h>
59 #include <__utility/move.h>
60 #include <experimental/__config>
61 #include <iterator>
63 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
64 #  pragma GCC system_header
65 #endif
67 _LIBCPP_PUSH_MACROS
68 #include <__undef_macros>
70 #if _LIBCPP_STD_VER >= 14
72 _LIBCPP_BEGIN_NAMESPACE_LFTS
74 template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
75 class ostream_joiner {
76 public:
77   typedef _CharT char_type;
78   typedef _Traits traits_type;
79   typedef basic_ostream<char_type, traits_type> ostream_type;
80   typedef output_iterator_tag iterator_category;
81   typedef void value_type;
82   typedef void difference_type;
83   typedef void pointer;
84   typedef void reference;
86   _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, _Delim&& __d)
87       : __output_iter_(std::addressof(__os)), __delim_(std::move(__d)), __first_(true) {}
89   _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, const _Delim& __d)
90       : __output_iter_(std::addressof(__os)), __delim_(__d), __first_(true) {}
92   template <typename _Tp>
93   _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator=(const _Tp& __v) {
94     if (!__first_)
95       *__output_iter_ << __delim_;
96     __first_ = false;
97     *__output_iter_ << __v;
98     return *this;
99   }
101   _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator*() _NOEXCEPT { return *this; }
102   _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++() _NOEXCEPT { return *this; }
103   _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
105 private:
106   ostream_type* __output_iter_;
107   _Delim __delim_;
108   bool __first_;
111 template <class _CharT, class _Traits, class _Delim>
112 _LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>
113 make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim&& __d) {
114   return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, std::forward<_Delim>(__d));
117 _LIBCPP_END_NAMESPACE_LFTS
119 #endif // _LIBCPP_STD_VER >= 14
121 _LIBCPP_POP_MACROS
123 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
124 #  include <iosfwd>
125 #  include <type_traits>
126 #endif
128 #endif // _LIBCPP_EXPERIMENTAL_ITERATOR