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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 6 07:47:29 PDT 2023


ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154612

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


Index: libcxx/include/__algorithm/move_backward.h
===================================================================
--- libcxx/include/__algorithm/move_backward.h
+++ libcxx/include/__algorithm/move_backward.h
@@ -80,7 +80,7 @@
                               !__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;
 
Index: libcxx/include/__algorithm/move.h
===================================================================
--- libcxx/include/__algorithm/move.h
+++ libcxx/include/__algorithm/move.h
@@ -73,7 +73,7 @@
                               !__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;
 
Index: libcxx/include/__algorithm/copy_backward.h
===================================================================
--- libcxx/include/__algorithm/copy_backward.h
+++ libcxx/include/__algorithm/copy_backward.h
@@ -80,7 +80,7 @@
                               !__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);
Index: libcxx/include/__algorithm/copy.h
===================================================================
--- libcxx/include/__algorithm/copy.h
+++ libcxx/include/__algorithm/copy.h
@@ -72,7 +72,7 @@
                               !__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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154612.537728.patch
Type: text/x-patch
Size: 3019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230706/6d39cc06/attachment.bin>


More information about the libcxx-commits mailing list