Skip to content
Snippets Groups Projects
Commit 687bb225 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

avoid deprecated use of std::iterator (deprecated with c++ 17)

Reduces insane amount of compiler warnings. Inheritance from std::iterator
template was used to define traits of an iterator. Cool people define these
traits directly nowadays.
parent ff466850
No related branches found
No related tags found
No related merge requests found
......@@ -58,8 +58,13 @@ char DLLEXPORT_OST_CONOP ResidueNameToOneLetterCode(String rn);
AminoAcid DLLEXPORT_OST_CONOP ResidueNameToAminoAcid(String rn);
class AminoAcidSetIterator : public std::iterator<std::forward_iterator_tag,
AminoAcid> {
class AminoAcidSetIterator {
using iterator_category = std::forward_iterator_tag;
using value_type = AminoAcid;
using difference_type = std::ptrdiff_t;
using pointer = AminoAcid*;
using reference = AminoAcid&;
public:
AminoAcidSetIterator(unsigned int bits, int start):
bits_(bits), curr_(start)
......
......@@ -19,13 +19,15 @@
#ifndef CIRCULAR_ITERATOR_HH
#define CIRCULAR_ITERATOR_HH
#include <iterator>
template<typename T>
class const_circular_iter : public std::iterator<std::bidirectional_iterator_tag,typename T::value_type>
class const_circular_iter
{
typedef typename T::const_iterator iterator;
typedef typename T::value_type value_type;
using iterator = typename T::const_iterator;
using iterator_category = std::bidirectional_iterator_tag;
using value_type = typename T::value_type;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
protected:
iterator iter;
iterator begin;
......@@ -97,10 +99,15 @@ public:
template<typename T>
class circular_iter : public std::iterator<std::bidirectional_iterator_tag,typename T::value_type>
class circular_iter
{
typedef typename T::iterator iterator;
typedef typename T::value_type value_type;
using iterator = typename T::iterator;
using iterator_category = std::bidirectional_iterator_tag;
using value_type = typename T::value_type;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
private:
iterator iter;
iterator begin;
......
......@@ -24,7 +24,14 @@
namespace ost { namespace mol { namespace impl {
template <typename T>
class pointer_it : public std::iterator<std::forward_iterator_tag, T>{
class pointer_it {
using iterator_category = std::forward_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using reference = T&;
public:
pointer_it(T* s): s_(s) { }
......
......@@ -26,8 +26,14 @@
*/
namespace ost { namespace seq {
class AlignedColumnIterator : public std::iterator<std::forward_iterator_tag,
AlignedColumn> {
class AlignedColumnIterator {
using iterator_category = std::forward_iterator_tag;
using value_type = AlignedColumn;
using difference_type = std::ptrdiff_t;
using pointer = AlignedColumn*;
using reference = AlignedColumn&;
private:
void UpdateVal()
{
......
......@@ -28,12 +28,18 @@ namespace ost { namespace seq { namespace impl {
/// \internal
template <typename T, typename I>
class TEMPLATE_EXPORT SequenceListIterator
: public std::iterator<std::random_access_iterator_tag, T>{
class TEMPLATE_EXPORT SequenceListIterator {
public:
typedef T ValueType;
typedef I IteratorType;
typedef SequenceListIterator<T, I> ClassType;
using ValueType = T;
using IteratorType = I;
using ClassType = SequenceListIterator<T, I>;
using iterator_category = std::random_access_iterator_tag;
using value_type = T; // duplicate
using difference_type = std::ptrdiff_t;
using pointer = T*;
using reference = T&;
protected:
void UpdateVal()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment