Skip to content

Commit

Permalink
Remove use of deprecated std::iterator (mfontanini#481)
Browse files Browse the repository at this point in the history
Co-authored-by: Ed Catmur <[email protected]>
  • Loading branch information
ecatmur and ecatmur authored Apr 30, 2023
1 parent ba0c820 commit e2a14d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions include/tins/address_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ namespace Tins {
* \brief AddressRange iterator class.
*/
template<typename Address>
class AddressRangeIterator : public std::iterator<std::forward_iterator_tag, const Address> {
class AddressRangeIterator {
public:
typedef typename std::iterator<std::forward_iterator_tag, const Address>::value_type value_type;
typedef std::forward_iterator_tag iterator_category;
typedef const Address value_type;
typedef std::ptrdiff_t difference_type;
typedef const Address* pointer;
typedef const Address& reference;

struct end_iterator {

Expand Down
8 changes: 7 additions & 1 deletion include/tins/sniffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,14 @@ HandlerProxy<T> make_sniffer_handler(T* ptr,
/**
* \brief Iterates over packets sniffed by a BaseSniffer.
*/
class SnifferIterator : public std::iterator<std::forward_iterator_tag, Packet> {
class SnifferIterator {
public:
typedef std::forward_iterator_tag iterator_category;
typedef Packet value_type;
typedef std::ptrdiff_t difference_type;
typedef Packet* pointer;
typedef Packet& reference;

/**
* Constructs a SnifferIterator.
* \param sniffer The sniffer to iterate.
Expand Down

0 comments on commit e2a14d8

Please sign in to comment.