This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][ranges] Add ranges::ssize CPO.

Authored by zoecarver on Apr 23 2021, 11:24 AM.



Based on D101079.

Diff Detail

Event Timeline

zoecarver requested review of this revision.Apr 23 2021, 11:24 AM
zoecarver created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2021, 11:24 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
cjdb added inline comments.Apr 23 2021, 11:37 AM

invocable<__size::__fn, _Tp>?

zoecarver updated this revision to Diff 340170.Apr 23 2021, 2:37 PM
  • Use invocable
  • Rebase
ldionne accepted this revision.Apr 30 2021, 2:57 PM

LGTM with changes applied.


Here instead I would just write

require (_Tp&& __t) { ranges::size(__t); }

and get rid of __can_invoke_size. Closer to the spec and simpler IMO.


Can we move the ssize tests to their own file?

This revision is now accepted and ready to land.Apr 30 2021, 2:57 PM
cjdb accepted this revision.Apr 30 2021, 3:19 PM

LGTM with a semiregular test!

zoecarver updated this revision to Diff 342560.May 3 2021, 3:07 PM
  • Rebase
  • Address Louis' comments
zoecarver updated this revision to Diff 342772.May 4 2021, 9:19 AM
  • Compute size types so they are correct on windows and 32bit.
ldionne accepted this revision.May 4 2021, 2:49 PM

LGTM (please update synopsis).

By the way, no need to re-run CI for such minor changes. Just make the change and ship it, no need to add any more latency to the loop.

zoecarver updated this revision to Diff 342901.May 4 2021, 4:20 PM
  • Add synopsis.
  • Rebase so the tests pass here too.
This revision was automatically updated to reflect the committed changes.