iterator (ostream_joiner): Simplify by using the injected-class-name and the ostream_type typedef.

* include/experimental/iterator (ostream_joiner): Simplify by using
	the injected-class-name and the ostream_type typedef.

From-SVN: r222728
This commit is contained in:
Jonathan Wakely 2015-05-02 19:03:20 +01:00 committed by Jonathan Wakely
parent a623b6f011
commit b4f504de77
2 changed files with 9 additions and 16 deletions

View File

@ -1,5 +1,8 @@
2015-05-02 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/iterator (ostream_joiner): Simplify by using
the injected-class-name and the ostream_type typedef.
* include/experimental/iterator: New. Define ostream_joiner.
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.

View File

@ -80,7 +80,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ }
template<typename _Tp>
ostream_joiner<_DelimT, _CharT, _Traits>&
ostream_joiner&
operator=(const _Tp& __value)
{
if (!_M_first)
@ -90,20 +90,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
ostream_joiner<_DelimT, _CharT, _Traits>&
operator*() noexcept
{ return *this; }
ostream_joiner<_DelimT, _CharT, _Traits>&
operator++() noexcept
{ return *this; }
ostream_joiner<_DelimT, _CharT, _Traits>&
operator++(int) noexcept
{ return *this; }
ostream_joiner& operator*() noexcept { return *this; }
ostream_joiner& operator++() noexcept { return *this; }
ostream_joiner& operator++(int) noexcept { return *this; }
private:
basic_ostream<_CharT, _Traits>* _M_out;
ostream_type* _M_out;
_DelimT _M_delim;
bool _M_first = true;
};
@ -113,9 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline ostream_joiner<decay_t<_DelimT>, _CharT, _Traits>
make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os,
_DelimT&& __delimiter)
{
return { __os, std::forward<_DelimT>(__delimiter) };
}
{ return { __os, std::forward<_DelimT>(__delimiter) }; }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace fundamentals_v2