libstdc++: iterator Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34#ifndef _GLIBCXX_EXPERIMENTAL_ITERATOR
35#define _GLIBCXX_EXPERIMENTAL_ITERATOR 1
36
37#pragma GCC system_header
38
40
41#if __cplusplus >= 201402L
42
46
47namespace std _GLIBCXX_VISIBILITY(default)
48{
49_GLIBCXX_BEGIN_NAMESPACE_VERSION
50
51namespace experimental
52{
53inline namespace fundamentals_v2
54{
55#define __cpp_lib_experimental_ostream_joiner 201411
56
57
58 template<typename _DelimT, typename _CharT = char,
59 typename _Traits = char_traits<_CharT>>
61 {
62 public:
63 typedef _CharT char_type;
64 typedef _Traits traits_type;
67 typedef void value_type;
68 typedef void difference_type;
69 typedef void pointer;
70 typedef void reference;
71
73 noexcept(is_nothrow_copy_constructible_v<_DelimT>)
75 { }
76
78 noexcept(is_nothrow_move_constructible_v<_DelimT>)
80 { }
81
82 template<typename _Tp>
84 operator=(const _Tp& __value)
85 {
86 if (!_M_first)
87 *_M_out << _M_delim;
88 _M_first = false;
89 *_M_out << __value;
90 return *this;
91 }
92
93 ostream_joiner& operator*() noexcept { return *this; }
94 ostream_joiner& operator++() noexcept { return *this; }
95 ostream_joiner& operator++(int) noexcept { return *this; }
96
97 private:
99 _DelimT _M_delim;
100 bool _M_first = true;
101 };
102
103
104 template<typename _CharT, typename _Traits, typename _DelimT>
107 _DelimT&& __delimiter)
108 { return { __os, std::forward<_DelimT>(__delimiter) }; }
109}
110}
111
112_GLIBCXX_END_NAMESPACE_VERSION
113}
114
115#endif
116
117#endif
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
ISO C++ entities toplevel namespace is std.
ostream_joiner< decay_t< _DelimT >, _CharT, _Traits > make_ostream_joiner(basic_ostream< _CharT, _Traits > &__os, _DelimT &&__delimiter)
Object generator for ostream_joiner.
Template class basic_ostream.
Marking output iterators.
Output iterator that inserts a delimiter between elements.