From b4f504de775cfbb362943f5bc37771623499c432 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Sat, 2 May 2015 19:03:20 +0100 Subject: [PATCH] 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 --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/include/experimental/iterator | 22 ++++++---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4f5fa683e2d..7c8ed664547 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2015-05-02 Jonathan Wakely + * 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. diff --git a/libstdc++-v3/include/experimental/iterator b/libstdc++-v3/include/experimental/iterator index 027043a9a45..9a38f6b2d0f 100644 --- a/libstdc++-v3/include/experimental/iterator +++ b/libstdc++-v3/include/experimental/iterator @@ -80,7 +80,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { } template - 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, _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 -- 2.30.2