[libcxx-commits] [libcxx] 9101479 - [libc++][NFC] Add 'const' to some operator()

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 6 13:46:49 PDT 2023


Author: Louis Dionne
Date: 2023-07-06T16:46:34-04:00
New Revision: 9101479420aa5ed9696a24d42f1975b8d9787a20

URL: https://github.com/llvm/llvm-project/commit/9101479420aa5ed9696a24d42f1975b8d9787a20
DIFF: https://github.com/llvm/llvm-project/commit/9101479420aa5ed9696a24d42f1975b8d9787a20.diff

LOG: [libc++][NFC] Add 'const' to some operator()

This is NFC because the function object is stateless anyway. This is
done solely for consistency with surrounding code and this was probably
an oversight in https://reviews.llvm.org/D132505.

Differential Revision: https://reviews.llvm.org/D154612

Added: 
    

Modified: 
    libcxx/include/__algorithm/copy.h
    libcxx/include/__algorithm/copy_backward.h
    libcxx/include/__algorithm/move.h
    libcxx/include/__algorithm/move_backward.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__algorithm/copy.h b/libcxx/include/__algorithm/copy.h
index c29ff8fa74bf3b..dfe9898c6480cf 100644
--- a/libcxx/include/__algorithm/copy.h
+++ b/libcxx/include/__algorithm/copy.h
@@ -72,7 +72,7 @@ struct __copy_loop {
                               !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
                           int> = 0>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
-  operator()(_InIter __first, _InIter __last, _OutIter __result) {
+  operator()(_InIter __first, _InIter __last, _OutIter __result) const {
     using _Traits = __segmented_iterator_traits<_OutIter>;
     using _DiffT  = typename common_type<__iter_
diff _t<_InIter>, __iter_
diff _t<_OutIter> >::type;
 

diff  --git a/libcxx/include/__algorithm/copy_backward.h b/libcxx/include/__algorithm/copy_backward.h
index 5bc93c62505b7a..d85d297b3226cc 100644
--- a/libcxx/include/__algorithm/copy_backward.h
+++ b/libcxx/include/__algorithm/copy_backward.h
@@ -80,7 +80,7 @@ struct __copy_backward_loop {
                               !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
                           int> = 0>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
-  operator()(_InIter __first, _InIter __last, _OutIter __result) {
+  operator()(_InIter __first, _InIter __last, _OutIter __result) const {
     using _Traits           = __segmented_iterator_traits<_OutIter>;
     auto __orig_last        = __last;
     auto __segment_iterator = _Traits::__segment(__result);

diff  --git a/libcxx/include/__algorithm/move.h b/libcxx/include/__algorithm/move.h
index b1b702a0637341..01aeef4e177e81 100644
--- a/libcxx/include/__algorithm/move.h
+++ b/libcxx/include/__algorithm/move.h
@@ -73,7 +73,7 @@ struct __move_loop {
                               !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
                           int> = 0>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
-  operator()(_InIter __first, _InIter __last, _OutIter __result) {
+  operator()(_InIter __first, _InIter __last, _OutIter __result) const {
     using _Traits = __segmented_iterator_traits<_OutIter>;
     using _DiffT  = typename common_type<__iter_
diff _t<_InIter>, __iter_
diff _t<_OutIter> >::type;
 

diff  --git a/libcxx/include/__algorithm/move_backward.h b/libcxx/include/__algorithm/move_backward.h
index db4c4db1cb9205..e396abfe0d389c 100644
--- a/libcxx/include/__algorithm/move_backward.h
+++ b/libcxx/include/__algorithm/move_backward.h
@@ -80,7 +80,7 @@ struct __move_backward_loop {
                               !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
                           int> = 0>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
-  operator()(_InIter __first, _InIter __last, _OutIter __result) {
+  operator()(_InIter __first, _InIter __last, _OutIter __result) const {
     using _Traits = __segmented_iterator_traits<_OutIter>;
     using _DiffT  = typename common_type<__iter_
diff _t<_InIter>, __iter_
diff _t<_OutIter> >::type;
 


        


More information about the libcxx-commits mailing list