This is an archive of the discontinued LLVM Phabricator instance.

Second part of P1227R2 - Signed ssize() functions, unsigned size() functions
ClosedPublic

Authored by mclow.lists on Feb 25 2019, 12:10 PM.

Details

Summary

Implement the global function std::ssize

Diff Detail

Event Timeline

mclow.lists created this revision.Feb 25 2019, 12:10 PM
mclow.lists marked an inline comment as done.Feb 25 2019, 12:11 PM
mclow.lists added inline comments.
libcxx/test/std/iterators/iterator.container/ssize.pass.cpp
25

I can remove this test for C++14

Made bits of the test more explicit.

mclow.lists retitled this revision from First part of P1227R2 - Signed ssize() functions, unsigned size() functions to Second part of P1227R2 - Signed ssize() functions, unsigned size() functions.Feb 25 2019, 7:49 PM
ldionne added inline comments.Feb 26 2019, 3:54 PM
libcxx/include/iterator
1868

Is there a reason for making this inline? Templates are already inline by default.

libcxx/test/std/iterators/iterator.container/ssize.pass.cpp
42

Why is this commented? I think we can have a libc++ specific check here because our std::size(Container const&) is marked noexcept conditionally on the noexcept-ness of container.size().

59

ditto

mclow.lists marked 2 inline comments as done.Feb 26 2019, 4:09 PM
mclow.lists added inline comments.
libcxx/include/iterator
1868

Nope; I'll remove it.

libcxx/test/std/iterators/iterator.container/ssize.pass.cpp
42

I just took this from the std::size tests. I can make them both check.

mclow.lists marked an inline comment as done and an inline comment as not done.

Update based on Louis' comments.
Make std::ssize conditionally noexcept.
Leave it as inline _LIBCPP_INLINE_VISIBILITY

Update the ssize tests to check the noexcept-ness.
Update the size tests to check the noexcept-ness.

libcxx/include/iterator
1868

All "the rest of these" (size,data, empty, etc) are inline _LIBCPP_INLINE_VISIBILITY. I left these new ones the same.

ldionne accepted this revision.Feb 26 2019, 4:50 PM
This revision is now accepted and ready to land.Feb 26 2019, 4:50 PM
mclow.lists closed this revision.Feb 26 2019, 7:02 PM

Committed as revision 354950