Skip to content

Commit ae342c2

Browse files
garymmJens-G
authored andcommitted
THRIFT-5698: remove use of deprecated std::iterator
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.
1 parent b10d0f2 commit ae342c2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/cpp/src/thrift/Thrift.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@
5050
namespace apache {
5151
namespace thrift {
5252

53-
class TEnumIterator
54-
: public std::iterator<std::forward_iterator_tag, std::pair<int, const char*> > {
53+
class TEnumIterator {
5554
public:
55+
using iterator_category = std::forward_iterator_tag;
56+
using value_type = std::pair<int, const char*>;
57+
5658
TEnumIterator(int n, int* enums, const char** names)
5759
: ii_(0), n_(n), enums_(enums), names_(names) {}
5860

lib/cpp/src/thrift/transport/TSocketUtils.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ struct AddressResolutionHelper {
6262
public:
6363
using PtrOwnedList = std::unique_ptr<addrinfo, addrinfo_deleter>;
6464

65-
struct Iter : std::iterator<std::forward_iterator_tag, const addrinfo*> {
65+
struct Iter {
66+
using iterator_category = std::forward_iterator_tag;
67+
using value_type = const addrinfo*;
68+
6669
value_type ptr = nullptr;
6770

6871
Iter() = default;

0 commit comments

Comments
 (0)