[libcxx-commits] [PATCH] D101079: [libcxx][ranges] Add ranges::size CPO.
Zoe Carver via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 22 10:19:34 PDT 2021
zoecarver added inline comments.
================
Comment at: libcxx/include/__ranges/size.h:77
+ requires(_Tp&& __t) {
+ // TODO: how do we convert to unsigned?
+ { ranges::begin(__t) } -> forward_iterator;
----------------
cjdb wrote:
> See http://eel.is/c++draft/ranges.syn#1.
>
> The result needs to be the `iter_difference_t<_Tp>`, and since I've asserted that we only care about (extended) integral types, we're clear to use `make_unsigned_t<iter_difference_t<_Tp>>`.
Okay good to know. `sized_sentinel_for` requires the result to be `iter_difference_t` so I don't think we need to check that here. I'll add a static cast below, though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101079/new/
https://reviews.llvm.org/D101079
More information about the libcxx-commits
mailing list