Skip to content

Commit c9cd33d

Browse files
committed
Rename __do_segment to __segment_processor
1 parent c39f423 commit c9cd33d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

libcxx/include/__algorithm/for_each.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ __for_each(_InputIterator __first, _Sent __last, _Function& __f) {
3333
return std::move(__f);
3434
}
3535

36-
// __do_segment acts as a functor for processing individual segments within the __for_each_segment{, _n} algorithms.
37-
template <class _InputIterator, class _Function>
38-
struct __do_segment {
39-
using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_InputIterator>;
36+
// __segment_processor handles the per-segment processing by applying the user-provided function to each element
37+
// within the segment. It acts as a functor passed to the segmented iterator algorithm __for_each_segment.
38+
template <class _SegmentedIterator, class _Function>
39+
struct __segment_processor {
40+
using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_SegmentedIterator>;
4041

4142
_Function& __func_;
4243

43-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __do_segment(_Function& __func) : __func_(__func) {}
44+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __segment_processor(_Function& __func)
45+
: __func_(__func) {}
4446

4547
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
4648
operator()(typename _Traits::__local_iterator __lfirst, typename _Traits::__local_iterator __llast) {
@@ -53,7 +55,7 @@ template <class _SegmentedIterator,
5355
__enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
5456
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Function
5557
__for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Function& __func) {
56-
std::__for_each_segment(__first, __last, std::__do_segment<_SegmentedIterator, _Function>(__func));
58+
std::__for_each_segment(__first, __last, std::__segment_processor<_SegmentedIterator, _Function>(__func));
5759
return std::move(__func);
5860
}
5961

libcxx/include/__algorithm/for_each_n.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ template <class _SegmentedIterator,
5353
int> = 0>
5454
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _SegmentedIterator
5555
for_each_n(_SegmentedIterator __first, _Size __orig_n, _Function __f) {
56-
return std::__for_each_n_segment(__first, __orig_n, std::__do_segment<_SegmentedIterator, _Function>(__f));
56+
return std::__for_each_n_segment(__first, __orig_n, std::__segment_processor<_SegmentedIterator, _Function>(__f));
5757
}
5858

5959
#endif

0 commit comments

Comments
 (0)