public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-9498] libstdc++: Implement LWG 3904 change to lazy_split_view's iterator Date: Sat, 29 Apr 2023 14:04:14 +0000 (GMT) [thread overview] Message-ID: <20230429140414.0647C3858C50@sourceware.org> (raw) https://gcc.gnu.org/g:05476c093a00c4ce31d7a19c72fc83b8796c05fe commit r12-9498-g05476c093a00c4ce31d7a19c72fc83b8796c05fe Author: Patrick Palka <ppalka@redhat.com> Date: Wed Apr 12 13:08:21 2023 -0400 libstdc++: Implement LWG 3904 change to lazy_split_view's iterator libstdc++-v3/ChangeLog: * include/std/ranges (lazy_split_view::_OuterIter::_OuterIter): Propagate _M_trailing_empty in the const-converting constructor as per LWG 3904. * testsuite/std/ranges/adaptors/lazy_split.cc (test12): New test. (cherry picked from commit aa65771427d32299cffecea64cbb766411aa8faf) Diff: --- libstdc++-v3/include/std/ranges | 3 ++- libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 443fe65da92..bfcc046c496 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -3188,7 +3188,8 @@ namespace views::__adaptor _OuterIter(_OuterIter<!_Const> __i) requires _Const && convertible_to<iterator_t<_Vp>, iterator_t<_Base>> - : _M_parent(__i._M_parent), _M_current(std::move(__i._M_current)) + : _M_parent(__i._M_parent), _M_current(std::move(__i._M_current)), + _M_trailing_empty(__i._M_trailing_empty) { } constexpr value_type diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc index 21c0837cdd3..5e1d99f636d 100644 --- a/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc @@ -22,6 +22,7 @@ #include <ranges> #include <string> #include <string_view> +#include <utility> #include <vector> #include <testsuite_hooks.h> #include <testsuite_iterators.h> @@ -218,6 +219,20 @@ test11() static_assert(ranges::distance(views::lazy_split("text"sv, ""sv)) == 4); } +constexpr bool +test12() +{ + // LWG 3904 + auto r = views::single(0) | views::lazy_split(0); + auto i = r.begin(); + ++i; + VERIFY( i != r.end() ); + decltype(std::as_const(r).begin()) j = i; + VERIFY( j != r.end() ); + + return true; +} + int main() { @@ -232,4 +247,5 @@ main() test09(); test10(); test11(); + static_assert(test12()); }
reply other threads:[~2023-04-29 14:04 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=20230429140414.0647C3858C50@sourceware.org \ --to=ppalka@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: linkBe 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).