Details
- Reviewers
• Quuxplusone Mordante - Group Reviewers
Restricted Project - Commits
- rGfbaf7f0bc768: [libc++] Add range_size_t
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM mod comments.
| libcxx/include/__ranges/concepts.h | ||
|---|---|---|
| 73 | This is actually from section [range.range], not [range.sized]. I doubt we care. | |
| libcxx/include/ranges | ||
| 39–40 | No, T was correct. https://eel.is/c++draft/ranges#syn | |
| libcxx/test/std/ranges/range.req/range.range/range_size_t.compile.pass.cpp | ||
| 29 | Please add SFINAE-friendliness tests. I recommend replacing this whole file with: template<class T>
concept has_size_t = requires { typename std::ranges::range_size_t<T>; };
struct A { int *begin(); int *end(); short size(); };
static_assert(std::same_as<std::ranges::range_size_t<A>, short>);
static_assert(std::same_as<std::ranges::range_size_t<A&>, short>);
static_assert(std::same_as<std::ranges::range_size_t<A&&>, short>);
static_assert(!has_size_t<const A>);
static_assert(!has_size_t<const A&>);
static_assert(!has_size_t<const A&&>);
struct B { int *begin(); int *end(); };
static_assert(std::same_as<std::ranges::range_size_t<B>, std::size_t>);
static_assert(std::same_as<std::ranges::range_size_t<B&>, std::size_t>);
static_assert(std::same_as<std::ranges::range_size_t<B&&>, std::size_t>);
static_assert(!has_size_t<const B>);
static_assert(!has_size_t<const B&>);
static_assert(!has_size_t<const B&&>);
struct C { bidirectional_iterator<int*> begin(); bidirectional_iterator<int*> end(); };
static_assert(!has_size_t<C>); | |
LGTM, modulo comment.
| libcxx/test/std/ranges/range.req/range.range/range_size_t.compile.pass.cpp | ||
|---|---|---|
| 29 | +1 | |
| libcxx/include/__ranges/concepts.h | ||
|---|---|---|
| 73 | Yeah, I couldn't put it in the section above cause it needs sized_range to be defined. I won't add another comment, that would just be confusing IMO. | |
This is actually from section [range.range], not [range.sized]. I doubt we care.