public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100833] New: ranges::advance should return n when i == bound
@ 2021-05-30 13:51 hewillk at gmail dot com
  2021-06-01 15:04 ` [Bug libstdc++/100833] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hewillk at gmail dot com @ 2021-05-30 13:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100833

            Bug ID: 100833
           Summary: ranges::advance should return n when i == bound
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

This is specified in [range.iter.op.advance#7]:
"Returns: n - M, where M is the difference between the ending and starting
positions of i."


#include <ranges>

constexpr auto diff = [] {
  auto r = std::views::single(0) | 
           std::views::filter([](int) { return true; });
  auto it = r.begin();
  return std::ranges::advance(it, 100, r.begin());
}();

static_assert(diff == 100);

https://godbolt.org/z/6nh8xMWYd

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-03 14:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-30 13:51 [Bug libstdc++/100833] New: ranges::advance should return n when i == bound hewillk at gmail dot com
2021-06-01 15:04 ` [Bug libstdc++/100833] " redi at gcc dot gnu.org
2021-06-01 16:09 ` cvs-commit at gcc dot gnu.org
2021-06-02 13:43 ` cvs-commit at gcc dot gnu.org
2021-06-03 14:58 ` cvs-commit at gcc dot gnu.org
2021-06-03 14:58 ` redi at gcc dot gnu.org

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).