Wdeprecated-declarations warnings on std::iterator
Started getting these warnings after the migration to sysrepo v2. These should be all of them:
encode/base_n.cc:170:33: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
170 | class DecodeNormalizer : public iterator<input_iterator_tag, char> {
| ^~~~~~~~
encode/base_n.cc:115:33: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
115 | class EncodeNormalizer : public iterator<input_iterator_tag, uint8_t> {
| ^~~~~~~~
../../../src/lib/dns/message.h:91:37: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
91 | class SectionIterator : public std::iterator<std::input_iterator_tag, T> {
| ^~~~~~~~
../../../src/lib/dns/rrset_collection_base.h:156:27: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
156 | class Iterator : std::iterator<std::forward_iterator_tag,
| ^~~~~~~~
The paper that deprecated it seems to have done so because of the bad practice of having to derive classes in the std
library.
Proposing to fix them. After minimal research, it would seem that removing the inheritance and having a few using declarations inside the formerly-derived class is sufficient e.g.:
using iterator_category = std::input_iterator_tag;
using value_type = T;