Skip to content

Commit b4008ad

Browse files
committed
[libc++] Implementing ranges::iota: Cleanup and addressing comments from @strega-nil
1 parent d50b7a1 commit b4008ad

File tree

7 files changed

+8
-11
lines changed

7 files changed

+8
-11
lines changed

libcxx/docs/Status/RangesAlgorithms.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ C++23,`shift_left <https://wg21.link/p2440r1>`_,Unassigned,No patch yet,Not star
99
C++23,`shift_right <https://wg21.link/p2440r1>`_,Unassigned,No patch yet,Not started
1010
C++23,`iota (algorithm) <https://wg21.link/p2440r1>`_,Unassigned,No patch yet,Not started
1111
C++23,`fold <https://wg21.link/p2322r5>`_,Unassigned,No patch yet,Not started
12-
C++23,`contains <https://wg21.link/p2302r2>`_,Zijun Zhao,No patch yet,In Progress
1312
C++23,`ranges::iota <https://wg21.link/P2440R1>`_, James E T Smith, `PR68494 <https://github.com/llvm/llvm-project/pull/68494>`_, In Progress
1413
C++23,`contains <https://wg21.link/p2302r2>`_,Zijun Zhao, `#65148 <https://github.com/llvm/llvm-project/pull/65148>`_,Complete
1514
C++23,`fold_left_with_iter <https://wg21.link/p2322r6>`_,Christopher Di Bella,N/A,Complete

libcxx/docs/Status/RangesMajorFeatures.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ Standard,Name,Assignee,CL,Status
22
C++23,`ranges::to <https://wg21.link/P1206R7>`_,Konstantin Varlamov,`D142335 <https://reviews.llvm.org/D142335>`_,Complete
33
C++23,`Pipe support for user-defined range adaptors <https://wg21.link/P2387R3>`_,"Louis Dionne, Jakub Mazurkiewicz, and Xiaoyang Liu",Various,Complete
44
C++23,`Formatting Ranges <https://wg21.link/P2286R8>`_,Mark de Wever,Various,Complete
5-
C++23, `ranges::iota <https://wg21.link/P2440R1>`_, James E T Smith, `PR68494 <https://github.com/llvm/llvm-project/pull/68494>`_, In Progress
65
C++20,`Stashing stashing iterators for proper flattening <https://wg21.link/P2770R0>`_,Jakub Mazurkiewicz,Various,In progress

libcxx/include/__numeric/ranges_iota.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct __iota_fn {
4848
template <weakly_incrementable _Tp, ranges::output_range<const _Tp&> _Range>
4949
_LIBCPP_HIDE_FROM_ABI static constexpr iota_result<ranges::borrowed_iterator_t<_Range>, _Tp>
5050
operator()(_Range&& __r, _Tp __value) {
51-
return __iota_fn::operator()(ranges::begin(__r), ranges::end(__r), std::move(__value));
51+
return operator()(ranges::begin(__r), ranges::end(__r), std::move(__value));
5252
}
5353
};
5454

libcxx/include/algorithm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ namespace ranges {
4242
template <class I>
4343
struct in_found_result; // since C++20
4444
45-
template <class O, class T>
46-
struct out_value_result; // since C++23
47-
4845
template <class I, class T>
4946
struct in_value_result; // since C++23
5047
48+
template <class O, class T>
49+
struct out_value_result; // since C++23
50+
5151
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
5252
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
5353
constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});

libcxx/test/std/algorithms/ranges_result_alias_declarations.compile.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ static_assert(std::is_same_v<in_found_result<int>, next_permutation_result<int>>
6363
static_assert(std::is_same_v<in_found_result<int>, prev_permutation_result<int>>);
6464

6565
#if TEST_STD_VER >= 23
66-
static_assert(std::is_same_v<out_value_result<int, int>, iota_result<int, int>>);
67-
6866
static_assert(std::is_same_v<in_value_result<int, long>, fold_left_with_iter_result<int, long>>);
67+
static_assert(std::is_same_v<out_value_result<int, int>, iota_result<int, int>>);
6968
#endif // TEST_STD_VER

libcxx/test/std/algorithms/ranges_robust_against_proxy_iterators.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ constexpr void run_tests() {
108108
test(std::ranges::search_n, in, count, x);
109109
test(std::ranges::find_end, in, in2);
110110
#if TEST_STD_VER >= 23
111-
if constexpr (std::copyable<T>) {
111+
if constexpr (std::weakly_incrementable<T>) {
112112
test(std::ranges::iota, in, x);
113113
}
114114
#endif

libcxx/test/support/test_iterators.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ struct Proxy : ProxyDiffTBase<T> {
11981198
// Calling swap(Proxy<T>{}, Proxy<T>{}) would fail (pass prvalues)
11991199

12001200
// Compare operators are defined for the convenience of the tests
1201-
friend constexpr bool operator==(const Proxy& lhs, const Proxy& rhs)
1201+
friend constexpr bool operator==(const Proxy&, const Proxy&)
12021202
requires(std::equality_comparable<T> && !std::is_reference_v<T>)
12031203
= default;
12041204

@@ -1210,7 +1210,7 @@ struct Proxy : ProxyDiffTBase<T> {
12101210
return lhs.data == rhs.data;
12111211
}
12121212

1213-
friend constexpr auto operator<=>(const Proxy& lhs, const Proxy& rhs)
1213+
friend constexpr auto operator<=>(const Proxy&, const Proxy&)
12141214
requires(std::three_way_comparable<T> && !std::is_reference_v<T>)
12151215
= default;
12161216

0 commit comments

Comments
 (0)