From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: Tim Song <t.canens.cpp@gmail.com>,
"libstdc++" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++: Avoid hard error in ranges::unique_copy [PR100770]
Date: Wed, 26 May 2021 20:55:22 +0100 [thread overview]
Message-ID: <CAH6eHdTzCongg__xCYu5ATGoKoPmyNSgsm=DUQC=zCrX919U+g@mail.gmail.com> (raw)
In-Reply-To: <c5f961df-d2ee-b83b-735c-28939285fcc@idea>
On Wed, 26 May 2021 at 20:11, Patrick Palka via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> On Wed, 26 May 2021, Tim Song wrote:
>
> > I noticed that output_iterator_wrapper still has a (non-void)
> > value_type. Perhaps we can get better coverage if it doesn't have one?
> > The existing tests should have caught this case with that change, at least.
>
> Good point, and I guess it should be fine to make its pointer and
> reference void as well. I'm testing:
Defining difference_type as void is also OK.
Before C++20 output iterators could define all of them as void. In
C++20 defining pointer as void means it doesn't support operator->(),
so either way it's OK for our output_iterator_wrapper.
> --- a/libstdc++-v3/testsuite/util/testsuite_iterators.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h
> @@ -122,7 +122,7 @@ namespace __gnu_test
> */
> template<class T>
> struct output_iterator_wrapper
> - : public std::iterator<std::output_iterator_tag, T, std::ptrdiff_t, T*, T&>
> + : public std::iterator<std::output_iterator_tag, void, std::ptrdiff_t, void, void>
> {
> protected:
> output_iterator_wrapper() : ptr(0), SharedInfo(0)
>
> >
> > On Wed, May 26, 2021 at 12:00 PM Patrick Palka via Libstdc++
> > <libstdc++@gcc.gnu.org> wrote:
> > >
> > > - else if constexpr (input_iterator<_Out>
> > > - && same_as<iter_value_t<_Iter>, iter_value_t<_Out>>)
> > > + else if constexpr (requires { requires (input_iterator<_Out>
> > > + && same_as<iter_value_t<_Iter>,
> > > + iter_value_t<_Out>>); })
> >
> > It's arguably cleaner to extract this into a concept which can then
> > also be used in the constraint.
>
> Sounds good, though I'm not sure what name to give to this relatively
> ad-hoc set of requirements. Any suggestions? :)
>
next prev parent reply other threads:[~2021-05-26 19:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 16:45 Patrick Palka
2021-05-26 17:27 ` Tim Song
2021-05-26 18:43 ` Patrick Palka
2021-05-26 19:07 ` Tim Song
2021-05-27 13:50 ` Patrick Palka
2021-06-03 11:54 ` Jonathan Wakely
2021-05-26 19:55 ` Jonathan Wakely [this message]
2021-05-27 0:38 ` Tim Song
2021-05-26 17:28 ` Jonathan Wakely
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='CAH6eHdTzCongg__xCYu5ATGoKoPmyNSgsm=DUQC=zCrX919U+g@mail.gmail.com' \
--to=jwakely.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
--cc=ppalka@redhat.com \
--cc=t.canens.cpp@gmail.com \
/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).