public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH 1/2] libstdc++: Implement ranges::adjacent_view from P2321R2
Date: Wed, 31 Aug 2022 11:26:37 +0100	[thread overview]
Message-ID: <CACb0b4=Fh8jHzjcOJ7Am4=eR7Ngaii_WPhmZPJju-v3dxBk1uw@mail.gmail.com> (raw)
In-Reply-To: <20220830171335.54110-1-ppalka@redhat.com>

On Tue, 30 Aug 2022 at 18:14, Patrick Palka via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?


> +    constexpr
> +    _Iterator(__as_sentinel, iterator_t<_Base> __first, iterator_t<_Base> __last)
> +    {
> +      if constexpr (!bidirectional_range<_Base>)
> +       for (auto& __it : _M_current)
> +         __it = __last;
> +      else
> +       for (ssize_t __i = _Nm-1; __i >= 0; --__i)

ssize_t is defined by POSIX in <sys/types.h> but isn't in ISO C or
C++. It looks like MinGW defines it to ... something ... sometimes,
but I don't think we can rely on it for non-POSIX targets.


> +    template<size_t _Nm>
> +      struct _Adjacent : __adaptor::_RangeAdaptorClosure
> +      {
> +       template<viewable_range _Range>
> +         requires (_Nm == 0) || __detail::__can_adjacent_view<_Nm, _Range>
> +         [[nodiscard]]
> +         constexpr auto
> +         operator()(_Range&& __r) const

Does this attribute actually work here?

I thought we needed to use `operator() [[nodiscard]]` for functions
with a requires-clause, because otherwise the attribute gives a parse
error. Maybe I've misremembered the problem, and it just doesn't give
a -Wunused-result warning. The decl above is setting off my spidey
sense for some reason though.


  parent reply	other threads:[~2022-08-31 10:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 17:13 Patrick Palka
2022-08-30 17:13 ` [PATCH 2/2] libstdc++: Implement ranges::adjacent_transform_view " Patrick Palka
2022-09-01 11:14   ` Jonathan Wakely
2022-08-31 10:26 ` Jonathan Wakely [this message]
2022-08-31 13:30   ` [PATCH 1/2] libstdc++: Implement ranges::adjacent_view " Patrick Palka
2022-08-31 13:31     ` 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='CACb0b4=Fh8jHzjcOJ7Am4=eR7Ngaii_WPhmZPJju-v3dxBk1uw@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ppalka@redhat.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).