public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] libstdc++: Implement remaining piece of LWG 3448
Date: Thu,  3 Sep 2020 16:03:14 +0000 (GMT)	[thread overview]
Message-ID: <20200903160314.40B8E3985827@sourceware.org> (raw)

https://gcc.gnu.org/g:3ae0cd94abc15e33dc06ca7a5f76f14b1d74129f

commit 3ae0cd94abc15e33dc06ca7a5f76f14b1d74129f
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Aug 26 21:51:48 2020 -0400

    libstdc++: Implement remaining piece of LWG 3448
    
    Almost all of the proposed resolution for LWG 3448 is already
    implemented; the only part left is to adjust the return type of
    transform_view::sentinel::operator-.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/95322
            * include/std/ranges (transform_view::sentinel::__distance_from):
            Give this a deduced return type.
            (transform_view::sentinel::operator-): Adjust the return type so
            that it's based on the constness of the iterator rather than
            that of the sentinel.
            * testsuite/std/ranges/adaptors/95322.cc: Refer to LWG 3488.

Diff:
---
 libstdc++-v3/include/std/ranges                     | 18 +++++++++---------
 libstdc++-v3/testsuite/std/ranges/adaptors/95322.cc |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 42028354b81..2d0017f1750 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -1865,7 +1865,7 @@ namespace views
 	  using _Base = __detail::__maybe_const_t<_Const, _Vp>;
 
 	  template<bool _Const2>
-	    constexpr range_difference_t<_Base>
+	    constexpr auto
 	    __distance_from(const _Iterator<_Const2>& __i) const
 	    { return _M_end - __i._M_current; }
 
@@ -1902,17 +1902,17 @@ namespace views
 	    operator==(const _Iterator<_Const2>& __x, const _Sentinel& __y)
 	    { return __y.__equal(__x); }
 
-	  template<bool _Const2>
-	    requires sized_sentinel_for<sentinel_t<_Base>,
-		       iterator_t<__detail::__maybe_const_t<_Const2, _Vp>>>
-	    friend constexpr range_difference_t<_Base>
+	  template<bool _Const2,
+		   typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>>
+	    requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>>
+	    friend constexpr range_difference_t<_Base2>
 	    operator-(const _Iterator<_Const2>& __x, const _Sentinel& __y)
 	    { return -__y.__distance_from(__x); }
 
-	  template<bool _Const2>
-	    requires sized_sentinel_for<sentinel_t<_Base>,
-		       iterator_t<__detail::__maybe_const_t<_Const2, _Vp>>>
-	    friend constexpr range_difference_t<_Base>
+	  template<bool _Const2,
+		   typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>>
+	    requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>>
+	    friend constexpr range_difference_t<_Base2>
 	    operator-(const _Sentinel& __y, const _Iterator<_Const2>& __x)
 	    { return __y.__distance_from(__x); }
 
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/95322.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/95322.cc
index 9279d5520a8..67bc7d33917 100644
--- a/libstdc++-v3/testsuite/std/ranges/adaptors/95322.cc
+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/95322.cc
@@ -26,7 +26,7 @@ using __gnu_test::test_forward_range;
 void
 test01()
 {
-  // PR libstdc++/95322
+  // PR libstdc++/95322 and LWG 3488
   int a[2]{1, 2};
   test_forward_range<int> v{a};
   auto view1 = v | std::views::take(2);


                 reply	other threads:[~2020-09-03 16:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200903160314.40B8E3985827@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).