You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "kou (via GitHub)" <gi...@apache.org> on 2025/06/10 00:43:01 UTC

[PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

kou opened a new pull request, #3165:
URL: https://github.com/apache/thrift/pull/3165

   <!-- Explain the changes in the pull request below: -->
   
   Client: cpp
   
   C++17 deprecated std::iterator.
   
   See
   https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/
   
   Prior to this change, compiling while targeting C++17 or higher results in warnings.
   
   <!-- We recommend you review the checklist/tips before submitting a pull request. -->
   
   - [x] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  ([Request account here](https://selfserve.apache.org/jira-account.html), not required for trivial changes)
   - [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
   - [x] Did you squash your changes to a single commit?  (not required, but preferred)
   - [x] Did you do your best to avoid breaking changes?  If one was needed, did you label the Jira ticket with "Breaking-Change"?
   - [x] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #3165:
URL: https://github.com/apache/thrift/pull/3165#issuecomment-2968747146

   Sorry... You're right. We should have defined `difference_type`, `pointer` and `reference` too...
   Thanks for fixing it in #3167.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

Posted by "CJCombrink (via GitHub)" <gi...@apache.org>.
CJCombrink commented on PR #3165:
URL: https://github.com/apache/thrift/pull/3165#issuecomment-2967897694

   @kou Thanks for the work but do you have any idea what goes wrong here:
   https://github.com/CJCombrink/thrift/actions/runs/15618763795/job/43998286079
   ```
   libtool: compile:  g++ -std=c++11 -DHAVE_CONFIG_H -I/usr/include -I../../../lib/cpp/src -I../../../lib/cpp/src/thrift -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -Wall -Wextra -pedantic -g -O2 -c gen-cpp/DebugProtoTest_types.cpp  -fPIC -DPIC -o gen-cpp/.libs/DebugProtoTest_types.o
   In file included from /usr/include/c++/13/map:63,
                    from ../../../lib/cpp/src/thrift/Thrift.h:38,
                    from gen-cpp/AnnotationTest_types.h:12,
                    from gen-cpp/AnnotationTest_types.cpp:7:
   /usr/include/c++/13/bits/stl_map.h: In instantiation of 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]':
   gen-cpp/AnnotationTest_types.cpp:34:184:   required from here
   /usr/include/c++/13/bits/stl_map.h:287:38: error: no matching function for call to 'std::_Rb_tree<int, std::pair<const int, const char*>, std::_Select1st<std::pair<const int, const char*> >, std::less<int>, std::allocator<std::pair<const int, const char*> > >::_M_insert_range_unique(apache::thrift::TEnumIterator&, apache::thrift::TEnumIterator&)'
     287 |         { _M_t._M_insert_range_unique(__first, __last); }
         |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
   In file included from /usr/include/c++/13/map:62:
   /usr/include/c++/13/bits/stl_tree.h:1100:9: note: candidate: 'template<class _InputIterator> std::__enable_if_t<std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _Key = int; _Val = std::pair<const int, const char*>; _KeyOfValue = std::_Select1st<std::pair<const int, const char*> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
    1100 |         _M_insert_range_unique(_InputIterator __first, _InputIterator __last)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   /usr/include/c++/13/bits/stl_tree.h:1100:9: note:   template argument deduction/substitution failed:
   /usr/include/c++/13/bits/stl_tree.h: In substitution of 'template<class _InputIterator> std::__enable_if_t<std::is_same<std::pair<const int, const char*>, typename std::iterator_traits< <template-parameter-1-1> >::value_type>::value, void> std::_Rb_tree<int, std::pair<const int, const char*>, std::_Select1st<std::pair<const int, const char*> >, std::less<int>, std::allocator<std::pair<const int, const char*> > >::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator]':
   /usr/include/c++/13/bits/stl_map.h:287:31:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
   gen-cpp/AnnotationTest_types.cpp:34:184:   required from here
   /usr/include/c++/13/bits/stl_tree.h:1100:9: error: no type named 'value_type' in 'struct std::iterator_traits<apache::thrift::TEnumIterator>'
   /usr/include/c++/13/bits/stl_map.h: In instantiation of 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]':
   gen-cpp/AnnotationTest_types.cpp:34:184:   required from here
   /usr/include/c++/13/bits/stl_tree.h:1109:9: note: candidate: 'template<class _InputIterator> std::__enable_if_t<(! std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value)> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _Key = int; _Val = std::pair<const int, const char*>; _KeyOfValue = std::_Select1st<std::pair<const int, const char*> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
    1109 |         _M_insert_range_unique(_InputIterator __first, _InputIterator __last)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   /usr/include/c++/13/bits/stl_tree.h:1109:9: note:   template argument deduction/substitution failed:
   /usr/include/c++/13/bits/stl_tree.h: In substitution of 'template<class _InputIterator> std::__enable_if_t<(! std::is_same<std::pair<const int, const char*>, typename std::iterator_traits< <template-parameter-1-1> >::value_type>::value), void> std::_Rb_tree<int, std::pair<const int, const char*>, std::_Select1st<std::pair<const int, const char*> >, std::less<int>, std::allocator<std::pair<const int, const char*> > >::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator]':
   /usr/include/c++/13/bits/stl_map.h:287:31:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
   gen-cpp/AnnotationTest_types.cpp:34:184:   required from here
   /usr/include/c++/13/bits/stl_tree.h:1108:59: error: no type named 'value_type' in 'struct std::iterator_traits<apache::thrift::TEnumIterator>'
    1108 |         __enable_if_t<!__same_value_type<_InputIterator>::value>
         |                                                           ^~~~~
   make[2]: *** [Makefile:1496: gen-cpp/AnnotationTest_types.lo] Error 1
   make[2]: *** Waiting for unfinished jobs....
   In file included from /usr/include/c++/13/map:63,
                    from ../../../lib/cpp/src/thrift/Thrift.h:38,
                    from gen-cpp/DebugProtoTest_types.h:12,
                    from gen-cpp/DebugProtoTest_types.cpp:7:
   /usr/include/c++/13/bits/stl_map.h: In instantiation of 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]':
   gen-cpp/DebugProtoTest_types.cpp:24:184:   required from here
   /usr/include/c++/13/bits/stl_map.h:287:38: error: no matching function for call to 'std::_Rb_tree<int, std::pair<const int, const char*>, std::_Select1st<std::pair<const int, const char*> >, std::less<int>, std::allocator<std::pair<const int, const char*> > >::_M_insert_range_unique(apache::thrift::TEnumIterator&, apache::thrift::TEnumIterator&)'
     287 |         { _M_t._M_insert_range_unique(__first, __last); }
         |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
   In file included from /usr/include/c++/13/map:62:
   /usr/include/c++/13/bits/stl_tree.h:1100:9: note: candidate: 'template<class _InputIterator> std::__enable_if_t<std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _Key = int; _Val = std::pair<const int, const char*>; _KeyOfValue = std::_Select1st<std::pair<const int, const char*> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
    1100 |         _M_insert_range_unique(_InputIterator __first, _InputIterator __last)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   /usr/include/c++/13/bits/stl_tree.h:1100:9: note:   template argument deduction/substitution failed:
   /usr/include/c++/13/bits/stl_tree.h: In substitution of 'template<class _InputIterator> std::__enable_if_t<std::is_same<std::pair<const int, const char*>, typename std::iterator_traits< <template-parameter-1-1> >::value_type>::value, void> std::_Rb_tree<int, std::pair<const int, const char*>, std::_Select1st<std::pair<const int, const char*> >, std::less<int>, std::allocator<std::pair<const int, const char*> > >::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator]':
   /usr/include/c++/13/bits/stl_map.h:287:31:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
   gen-cpp/DebugProtoTest_types.cpp:24:184:   required from here
   /usr/include/c++/13/bits/stl_tree.h:1100:9: error: no type named 'value_type' in 'struct std::iterator_traits<apache::thrift::TEnumIterator>'
   /usr/include/c++/13/bits/stl_map.h: In instantiation of 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]':
   gen-cpp/DebugProtoTest_types.cpp:24:184:   required from here
   /usr/include/c++/13/bits/stl_tree.h:1109:9: note: candidate: 'template<class _InputIterator> std::__enable_if_t<(! std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value)> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _Key = int; _Val = std::pair<const int, const char*>; _KeyOfValue = std::_Select1st<std::pair<const int, const char*> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
    1109 |         _M_insert_range_unique(_InputIterator __first, _InputIterator __last)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   /usr/include/c++/13/bits/stl_tree.h:1109:9: note:   template argument deduction/substitution failed:
   /usr/include/c++/13/bits/stl_tree.h: In substitution of 'template<class _InputIterator> std::__enable_if_t<(! std::is_same<std::pair<const int, const char*>, typename std::iterator_traits< <template-parameter-1-1> >::value_type>::value), void> std::_Rb_tree<int, std::pair<const int, const char*>, std::_Select1st<std::pair<const int, const char*> >, std::less<int>, std::allocator<std::pair<const int, const char*> > >::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator]':
   /usr/include/c++/13/bits/stl_map.h:287:31:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = const char*; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, const char*> >]'
   gen-cpp/DebugProtoTest_types.cpp:24:184:   required from here
   /usr/include/c++/13/bits/stl_tree.h:1108:59: error: no type named 'value_type' in 'struct std::iterator_traits<apache::thrift::TEnumIterator>'
    1108 |         __enable_if_t<!__same_value_type<_InputIterator>::value>
         |                                                           ^~~~~
   make[2]: *** [Makefile:1496: gen-cpp/DebugProtoTest_types.lo] Error 1
   ```
   
   Looks related


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #3165:
URL: https://github.com/apache/thrift/pull/3165#issuecomment-2957752477

   NOTE: The commit content is same as https://github.com/apache/thrift/pull/2778 .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

Posted by "CJCombrink (via GitHub)" <gi...@apache.org>.
CJCombrink commented on PR #3165:
URL: https://github.com/apache/thrift/pull/3165#issuecomment-2969186771

   @kou No worries, thanks for initiating this fix :+1: 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

Posted by "Jens-G (via GitHub)" <gi...@apache.org>.
Jens-G merged PR #3165:
URL: https://github.com/apache/thrift/pull/3165


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

Posted by "CJCombrink (via GitHub)" <gi...@apache.org>.
CJCombrink commented on PR #3165:
URL: https://github.com/apache/thrift/pull/3165#issuecomment-2968015262

   From some reading (eg. [std::iterator is deprecated: Why, What It Was, and What to Use Instead](https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/)) it seems like all 5 options must be specified when replacing the deprecated `std::iterator`
   
   This is confirmed in this change: https://github.com/CJCombrink/thrift/commit/2dd5c9d33537b6df356943559aeea6e0408c020a
   ([action](https://github.com/CJCombrink/thrift/actions/runs/15619527977/job/44001014743)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-5698: remove use of deprecated std::iterator [thrift]

Posted by "mhlakhani (via GitHub)" <gi...@apache.org>.
mhlakhani commented on PR #3165:
URL: https://github.com/apache/thrift/pull/3165#issuecomment-3123772762

   I split out the build fix into this PR (thank you @CJCombrink for doing the real work!) https://github.com/apache/thrift/pull/3182 -- I was running into issues.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org