public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "Daniel Krügler" <daniel.kruegler@gmail.com>
Cc: libstdc++ <libstdc++@gcc.gnu.org>,
	       gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] std::experimental::ostream_joiner
Date: Sat, 02 May 2015 18:04:00 -0000	[thread overview]
Message-ID: <20150502180404.GE3618@redhat.com> (raw)
In-Reply-To: <CAGNvRgDqyprOL42ZaijNPhisPSRcdRhA7VaXeGispihM6A0K4g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

On 02/05/15 19:34 +0200, Daniel Krügler wrote:
>2015-05-02 19:14 GMT+02:00 Jonathan Wakely <jwakely@redhat.com>:
>> The last piece of the Library Fundamentals 2 TS (until next week when
>> all of v1 gets voted into v2, when it will include the v1 stuff we're
>> missing).
>>
>> Tested powerpc64le-linux, committed to trunk.
>
>Do you really want to copy the ugliness of the Standard specification
>for in-class members or could this be made more readable as follows
>(affects four members):
>
>ostream_joiner<_DelimT, _CharT, _Traits>&
>=>
>ostream_joiner&
>
>? [I'm asking because I have not seen this to be the general style
>used in libstdc++]

Good point, I should probably stop working now, I've already spent my
whole Saturday and I'm clearly not paying attention properly!

The TS should be fixed to use the injected-class-name too:
https://github.com/cplusplus/fundamentals-ts/pull/56

Fixed by this patch, tested powerpc64le-linux and committed to trunk.

[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1830 bytes --]

commit af7ef923b9b95f5c7c59e6706095fba460a23a81
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat May 2 19:00:16 2015 +0100

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

diff --git a/libstdc++-v3/include/experimental/iterator b/libstdc++-v3/include/experimental/iterator
index 027043a..9a38f6b 100644
--- a/libstdc++-v3/include/experimental/iterator
+++ b/libstdc++-v3/include/experimental/iterator
@@ -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

      reply	other threads:[~2015-05-02 18:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-02 17:14 Jonathan Wakely
2015-05-02 17:34 ` Daniel Krügler
2015-05-02 18:04   ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150502180404.GE3618@redhat.com \
    --to=jwakely@redhat.com \
    --cc=daniel.kruegler@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).