Warning, /include/c++/v1/__cxx03/experimental/iterator is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP___CXX03_EXPERIMENTAL_ITERATOR
0011 #define _LIBCPP___CXX03_EXPERIMENTAL_ITERATOR
0012
0013 /*
0014 namespace std {
0015 namespace experimental {
0016 inline namespace fundamentals_v2 {
0017
0018 template <class DelimT, class charT = char, class traits = char_traits<charT>>
0019 class ostream_joiner {
0020 public:
0021 typedef charT char_type;
0022 typedef traits traits_type;
0023 typedef basic_ostream<charT, traits> ostream_type;
0024 typedef output_iterator_tag iterator_category;
0025 typedef void value_type;
0026 typedef void difference_type;
0027 typedef void pointer;
0028 typedef void reference;
0029
0030 ostream_joiner(ostream_type& s, const DelimT& delimiter);
0031 ostream_joiner(ostream_type& s, DelimT&& delimiter);
0032
0033 template<typename T>
0034 ostream_joiner& operator=(const T& value);
0035
0036 ostream_joiner& operator*() noexcept;
0037 ostream_joiner& operator++() noexcept;
0038 ostream_joiner& operator++(int) noexcept;
0039 private:
0040 ostream_type* out_stream; // exposition only
0041 DelimT delim; // exposition only
0042 bool first_element; // exposition only
0043 };
0044
0045 template <class charT, class traits, class DelimT>
0046 ostream_joiner<decay_t<DelimT>, charT, traits>
0047 make_ostream_joiner(basic_ostream<charT, traits>& os, DelimT&& delimiter);
0048
0049 } // inline namespace fundamentals_v2
0050 } // namespace experimental
0051 } // namespace std
0052
0053 */
0054
0055 #include <__cxx03/__memory/addressof.h>
0056 #include <__cxx03/__type_traits/decay.h>
0057 #include <__cxx03/__utility/forward.h>
0058 #include <__cxx03/__utility/move.h>
0059 #include <__cxx03/experimental/__config>
0060 #include <__cxx03/iterator>
0061
0062 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0063 # pragma GCC system_header
0064 #endif
0065
0066 _LIBCPP_PUSH_MACROS
0067 #include <__cxx03/__undef_macros>
0068
0069 #if _LIBCPP_STD_VER >= 14
0070
0071 _LIBCPP_BEGIN_NAMESPACE_LFTS
0072
0073 template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
0074 class ostream_joiner {
0075 public:
0076 typedef _CharT char_type;
0077 typedef _Traits traits_type;
0078 typedef basic_ostream<char_type, traits_type> ostream_type;
0079 typedef output_iterator_tag iterator_category;
0080 typedef void value_type;
0081 typedef void difference_type;
0082 typedef void pointer;
0083 typedef void reference;
0084
0085 _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, _Delim&& __d)
0086 : __output_iter_(std::addressof(__os)), __delim_(std::move(__d)), __first_(true) {}
0087
0088 _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, const _Delim& __d)
0089 : __output_iter_(std::addressof(__os)), __delim_(__d), __first_(true) {}
0090
0091 template <typename _Tp>
0092 _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator=(const _Tp& __v) {
0093 if (!__first_)
0094 *__output_iter_ << __delim_;
0095 __first_ = false;
0096 *__output_iter_ << __v;
0097 return *this;
0098 }
0099
0100 _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator*() _NOEXCEPT { return *this; }
0101 _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++() _NOEXCEPT { return *this; }
0102 _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
0103
0104 private:
0105 ostream_type* __output_iter_;
0106 _Delim __delim_;
0107 bool __first_;
0108 };
0109
0110 template <class _CharT, class _Traits, class _Delim>
0111 _LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>
0112 make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim&& __d) {
0113 return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, std::forward<_Delim>(__d));
0114 }
0115
0116 _LIBCPP_END_NAMESPACE_LFTS
0117
0118 #endif // _LIBCPP_STD_VER >= 14
0119
0120 _LIBCPP_POP_MACROS
0121
0122 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0123 # include <__cxx03/iosfwd>
0124 # include <__cxx03/type_traits>
0125 #endif
0126
0127 #endif // _LIBCPP___CXX03_EXPERIMENTAL_ITERATOR