Skip to content

Commit f4feedb

Browse files
committed
fix comma
fix comma
1 parent c94e17c commit f4feedb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

libcxx/include/__ranges/adjacent_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class adjacent_view<_View, _Np>::__iterator {
181181
}
182182

183183
template <class _Tp, size_t... _Is>
184-
static auto __repeat_tuple_helper(index_sequence<_Is...>) -> tuple<decltype((_Is, std::declval<_Tp (*)()>()()))...>;
184+
static auto __repeat_tuple_helper(index_sequence<_Is...>) -> tuple<decltype(std::declval<_Tp (*)(size_t)>()(_Is))...>;
185185

186186
public:
187187
using iterator_category = input_iterator_tag;

libcxx/test/std/ranges/range.adaptors/range.adjacent/iterator/member_types.compile.pass.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ struct ConstVeryDifferentRange {
4646
forward_iterator<double*> end() const;
4747
};
4848

49+
struct OverloadComma {
50+
friend int operator,(auto&&, OverloadComma);
51+
};
52+
4953
template <std::size_t N>
5054
void test() {
5155
int buffer[] = {1, 2, 3, 4};
@@ -147,4 +151,15 @@ void test() {
147151
test<2>();
148152
test<3>();
149153
test<5>();
154+
155+
{
156+
// overload comma operator
157+
OverloadComma buffer[] = {OverloadComma{}, OverloadComma{}, OverloadComma{}};
158+
auto v = std::views::adjacent<2>(buffer);
159+
using Iter = decltype(v.begin());
160+
static_assert(std::is_same_v<typename Iter::iterator_concept, std::random_access_iterator_tag>);
161+
static_assert(std::is_same_v<typename Iter::iterator_category, std::input_iterator_tag>);
162+
static_assert(std::is_same_v<typename Iter::difference_type, std::ptrdiff_t>);
163+
static_assert(std::is_same_v<typename Iter::value_type, std::tuple<OverloadComma, OverloadComma>>);
164+
}
150165
}

0 commit comments

Comments
 (0)