iterator (ostream_joiner): Simplify by using the injected-class-name and the ostream_...
authorJonathan Wakely <jwakely@redhat.com>
Sat, 2 May 2015 18:03:20 +0000 (19:03 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Sat, 2 May 2015 18:03:20 +0000 (19:03 +0100)
* include/experimental/iterator (ostream_joiner): Simplify by using
the injected-class-name and the ostream_type typedef.

From-SVN: r222728

libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/iterator

index 4f5fa683e2dc87e0636f4ea56127561609e445fa..7c8ed66454730791a409bb0fef31e5e812b1351e 100644 (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.
index 027043a9a45cd42a7fe210b860499d3eb00c07c7..9a38f6b2d0f37e21b6649587c3625a7a99e726f6 100644 (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