Skip to content

Commit 8e049fa

Browse files
authored
[libc++] Rename __range_adaptor_closure_t (llvm#110886)
The name __range_adaptor_closure_t can easily be confused with __range_adaptor_closure, so something more distinct is preferable. Fixes llvm#67611
1 parent eafa150 commit 8e049fa

11 files changed

+16
-20
lines changed

libcxx/include/__ranges/chunk_by_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ struct __fn {
215215
requires constructible_from<decay_t<_Pred>, _Pred>
216216
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
217217
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
218-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
218+
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
219219
}
220220
};
221221
} // namespace __chunk_by

libcxx/include/__ranges/drop_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ struct __fn {
307307
requires constructible_from<decay_t<_Np>, _Np>
308308
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
309309
noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
310-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
310+
return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n)));
311311
}
312312
};
313313

libcxx/include/__ranges/drop_while_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct __fn {
115115
requires constructible_from<decay_t<_Pred>, _Pred>
116116
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
117117
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
118-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
118+
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
119119
}
120120
};
121121

libcxx/include/__ranges/filter_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ struct __fn {
239239
requires constructible_from<decay_t<_Pred>, _Pred>
240240
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
241241
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
242-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
242+
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
243243
}
244244
};
245245
} // namespace __filter

libcxx/include/__ranges/lazy_split_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ struct __fn {
420420
requires constructible_from<decay_t<_Pattern>, _Pattern>
421421
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
422422
noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
423-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
423+
return __pipeable(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
424424
}
425425
};
426426
} // namespace __lazy_split_view

libcxx/include/__ranges/range_adaptor.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ namespace ranges {
4747
// - `f1 | f2` is an adaptor closure `g` such that `g(x)` is equivalent to `f2(f1(x))`
4848
template <class _Tp>
4949
requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
50-
struct __range_adaptor_closure;
50+
struct __range_adaptor_closure {};
5151

5252
// Type that wraps an arbitrary function object and makes it into a range adaptor closure,
5353
// i.e. something that can be called via the `x | f` notation.
5454
template <class _Fn>
55-
struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> {
56-
_LIBCPP_HIDE_FROM_ABI constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) {}
55+
struct __pipeable : _Fn, __range_adaptor_closure<__pipeable<_Fn>> {
56+
_LIBCPP_HIDE_FROM_ABI constexpr explicit __pipeable(_Fn&& __f) : _Fn(std::move(__f)) {}
5757
};
58-
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__range_adaptor_closure_t);
58+
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__pipeable);
5959

6060
template <class _Tp>
6161
_Tp __derived_from_range_adaptor_closure(__range_adaptor_closure<_Tp>*);
@@ -79,13 +79,9 @@ template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
7979
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept(
8080
is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
8181
is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>) {
82-
return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1)));
82+
return __pipeable(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1)));
8383
}
8484

85-
template <class _Tp>
86-
requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
87-
struct __range_adaptor_closure {};
88-
8985
# if _LIBCPP_STD_VER >= 23
9086
template <class _Tp>
9187
requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>

libcxx/include/__ranges/split_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ struct __fn {
211211
requires constructible_from<decay_t<_Pattern>, _Pattern>
212212
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
213213
noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
214-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
214+
return __pipeable(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
215215
}
216216
};
217217
} // namespace __split_view

libcxx/include/__ranges/take_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ struct __fn {
347347
requires constructible_from<decay_t<_Np>, _Np>
348348
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
349349
noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
350-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
350+
return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n)));
351351
}
352352
};
353353

libcxx/include/__ranges/take_while_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct __fn {
149149
requires constructible_from<decay_t<_Pred>, _Pred>
150150
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
151151
noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
152-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
152+
return __pipeable(std::__bind_back(*this, std::forward<_Pred>(__pred)));
153153
}
154154
};
155155

libcxx/include/__ranges/to.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ template <class _Container, class... _Args>
214214
}
215215
{ return ranges::to<_Container>(std::forward<_Range>(__range), std::forward<_Tail>(__tail)...); };
216216

217-
return __range_adaptor_closure_t(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
217+
return __pipeable(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
218218
}
219219

220220
// Range adaptor closure object 2 -- wrapping the `ranges::to` version where `_Container` is a template template
@@ -233,7 +233,7 @@ template <template <class...> class _Container, class... _Args>
233233
};
234234
// clang-format on
235235

236-
return __range_adaptor_closure_t(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
236+
return __pipeable(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
237237
}
238238

239239
} // namespace ranges

libcxx/include/__ranges/transform_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ struct __fn {
398398
requires constructible_from<decay_t<_Fn>, _Fn>
399399
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f) const
400400
noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) {
401-
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f)));
401+
return __pipeable(std::__bind_back(*this, std::forward<_Fn>(__f)));
402402
}
403403
};
404404
} // namespace __transform

0 commit comments

Comments
 (0)