Skip to content

Commit 5aa59ab

Browse files
committed
Fix reviewer comments
1 parent 0193ae1 commit 5aa59ab

File tree

15 files changed

+41
-12
lines changed

15 files changed

+41
-12
lines changed

libcxx/include/__algorithm/for_each.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,26 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __for_each(_InputIterat
3434

3535
// __segment_processor handles the per-segment processing by applying the function object __func_ to each
3636
// element within the segment.
37-
template <class _SegmentedIterator, class _Func>
37+
template <class _Func>
3838
struct __segment_processor {
39-
using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_SegmentedIterator>;
40-
4139
_Func& __func_;
4240

4341
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __segment_processor(_Func& __f) : __func_(__f) {}
4442

43+
template <class _SegmentedIterator>
4544
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
46-
operator()(typename _Traits::__local_iterator __lfirst, typename _Traits::__local_iterator __llast) {
45+
operator()(typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator __lfirst,
46+
typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator __llast) {
4747
std::__for_each(__lfirst, __llast, __func_);
4848
}
4949
};
5050

5151
template <class _SegmentedIterator,
5252
class _Function,
5353
__enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
54-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Function
55-
__for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Function __func) {
56-
std::__for_each_segment(__first, __last, std::__segment_processor<_SegmentedIterator, _Function>(__func));
57-
return __func;
54+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
55+
__for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Function& __func) {
56+
std::__for_each_segment(__first, __last, std::__segment_processor<_Function>(__func));
5857
}
5958

6059
template <class _InputIterator, class _Function>

libcxx/include/__algorithm/for_each_segment.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ __for_each_segment(_SegmentedIterator __first, _SegmentedIterator __last, _Funct
3232

3333
// We are in a single segment, so we might not be at the beginning or end
3434
if (__sfirst == __slast) {
35-
__func(_Traits::__local(__first), _Traits::__local(__last));
35+
__func.template operator()<_SegmentedIterator>(_Traits::__local(__first), _Traits::__local(__last));
3636
return;
3737
}
3838

3939
// We have more than one segment. Iterate over the first segment, since we might not start at the beginning
40-
__func(_Traits::__local(__first), _Traits::__end(__sfirst));
40+
__func.template operator()<_SegmentedIterator>(_Traits::__local(__first), _Traits::__end(__sfirst));
4141
++__sfirst;
4242
// iterate over the segments which are guaranteed to be completely in the range
4343
while (__sfirst != __slast) {
44-
__func(_Traits::__begin(__sfirst), _Traits::__end(__sfirst));
44+
__func.template operator()<_SegmentedIterator>(_Traits::__begin(__sfirst), _Traits::__end(__sfirst));
4545
++__sfirst;
4646
}
4747
// iterate over the last segment
48-
__func(_Traits::__begin(__sfirst), _Traits::__local(__last));
48+
__func.template operator()<_SegmentedIterator>(_Traits::__begin(__sfirst), _Traits::__local(__last));
4949
}
5050

5151
_LIBCPP_END_NAMESPACE_STD

libcxx/include/algorithm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,7 @@ template <class BidirectionalIterator, class Compare>
20612061
# include <cstring>
20622062
# include <iterator>
20632063
# include <memory>
2064+
# include <optional>
20642065
# include <stdexcept>
20652066
# include <type_traits>
20662067
# include <utility>

libcxx/include/array

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ _LIBCPP_POP_MACROS
566566
# include <cstdlib>
567567
# include <iterator>
568568
# include <new>
569+
# include <optional>
569570
# include <type_traits>
570571
# include <utility>
571572
# endif

libcxx/include/bitset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ _LIBCPP_POP_MACROS
973973
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
974974
# include <concepts>
975975
# include <cstdlib>
976+
# include <optional>
976977
# include <type_traits>
977978
# endif
978979
#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)

libcxx/include/codecvt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ _LIBCPP_END_NAMESPACE_STD
596596
# include <limits>
597597
# include <mutex>
598598
# include <new>
599+
# include <optional>
599600
# include <stdexcept>
600601
# include <type_traits>
601602
# include <typeinfo>

libcxx/include/condition_variable

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ _LIBCPP_POP_MACROS
357357
# include <initializer_list>
358358
# include <iosfwd>
359359
# include <new>
360+
# include <optional>
360361
# include <stdexcept>
361362
# include <system_error>
362363
# include <type_traits>

libcxx/include/ios

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,7 @@ _LIBCPP_POP_MACROS
887887
# include <limits>
888888
# include <mutex>
889889
# include <new>
890+
# include <optional>
890891
# include <stdexcept>
891892
# include <system_error>
892893
# include <type_traits>

libcxx/include/locale

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3666,6 +3666,7 @@ _LIBCPP_POP_MACROS
36663666
# include <cstdarg>
36673667
# include <iterator>
36683668
# include <mutex>
3669+
# include <optional>
36693670
# include <stdexcept>
36703671
# include <type_traits>
36713672
# include <typeinfo>

libcxx/include/streambuf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ _LIBCPP_POP_MACROS
386386

387387
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
388388
# include <cstdint>
389+
# include <optional>
389390
# endif
390391
#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
391392

0 commit comments

Comments
 (0)