public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Patrick Palka <ppalka@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org, Patrick Palka <ppalka@redhat.com>
Subject: [PATCH 3/3] libstdc++: Fix return type of empty zip/adjacent_transform [PR106803]
Date: Fri,  9 Sep 2022 13:24:46 -0400	[thread overview]
Message-ID: <20220909172446.1546805-3-ppalka@redhat.com> (raw)
In-Reply-To: <20220909172446.1546805-1-ppalka@redhat.com>

Tested on x86_64-pc-linux-gnu, does this series look OK for trunk?

	PR libstdc++/106803

libstdc++-v3/ChangeLog:

	* include/std/ranges (views::_ZipTransform::operator()): Fix
	return type in the empty case.
	(views::_AdjacentTransform::operator()): Likewise.
---
 libstdc++-v3/include/std/ranges | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 37ad80ad3de..20eb4e82ac8 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -5071,7 +5071,7 @@ namespace views::__adaptor
 	operator() [[nodiscard]] (_Fp&& __f, _Ts&&... __ts) const
 	{
 	  if constexpr (sizeof...(_Ts) == 0)
-	    return views::empty<decay_t<invoke_result_t<_Fp>>>;
+	    return views::empty<decay_t<invoke_result_t<decay_t<_Fp>&>>>;
 	  else
 	    return zip_transform_view(std::forward<_Fp>(__f), std::forward<_Ts>(__ts)...);
 	}
@@ -5762,7 +5762,7 @@ namespace views::__adaptor
 	  operator() [[nodiscard]] (_Range&& __r, _Fp&& __f) const
 	  {
 	    if constexpr (_Nm == 0)
-	      return views::empty<tuple<>>;
+	      return zip_transform(std::forward<_Fp>(__f));
 	    else
 	      return adjacent_transform_view<all_t<_Range>, decay_t<_Fp>, _Nm>
 		(std::forward<_Range>(__r), std::forward<_Fp>(__f));
-- 
2.37.3.518.g79f2338b37


      parent reply	other threads:[~2022-09-09 17:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 17:24 [PATCH 1/3] libstdc++: Fix zip_view's operator- for integer-class difference type [PR106766] Patrick Palka
2022-09-09 17:24 ` [PATCH 2/3] libstdc++: Fix typo in adjacent_view::_Iterator [PR106798] Patrick Palka
2022-09-09 17:24 ` Patrick Palka [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=20220909172446.1546805-3-ppalka@redhat.com \
    --to=ppalka@redhat.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).