Skip to content
Snippets Groups Projects
Commit 49f91777 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

std: stop using std::iterator

std::iterator is deprecated in C++17
parent ef52757b
No related branches found
No related tags found
1 merge request!204Merge jt
......@@ -115,7 +115,7 @@ public:
*
* The iterator performs a top to bottom, left to right or depth first travrsal stopping at each node twice. Once as it enters it the first time and second time when it leaves it (on the way to its parent).
*/
class const_structure_iterator : public std::iterator < std::bidirectional_iterator_tag, T > {
class const_structure_iterator {
/**
* \brief
* The underlying iterator within some list of children.
......@@ -141,6 +141,12 @@ public:
bool isEnd;
 
public:
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = const T*;
using reference = const T&;
using iterator_category = std::bidirectional_iterator_tag;
/**
* \brief
* Constructor of the iterator based on the iterator to child list
......@@ -319,7 +325,7 @@ public:
*
* The prefix iterator is constructed as a wrapper over structure iterator, it selects only non-virtual nodes.
*/
class const_prefix_iterator : public std::iterator < std::bidirectional_iterator_tag, T > {
class const_prefix_iterator {
/**
* \brief
* The underlying structure iterator.
......@@ -327,6 +333,12 @@ public:
const_structure_iterator node;
 
public:
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = const T*;
using reference = const T&;
using iterator_category = std::bidirectional_iterator_tag;
/**
* \brief
* Constructor of the iterator based on the iterator to child list
......@@ -450,7 +462,7 @@ public:
*
* The prefix iterator is constructed as a wrapper over structure iterator, it selects only virtual nodes.
*/
class const_postfix_iterator : public std::iterator < std::bidirectional_iterator_tag, T > {
class const_postfix_iterator {
/**
* \brief
* The underlying structure iterator.
......@@ -458,6 +470,12 @@ public:
const_structure_iterator node;
 
public:
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = const T*;
using reference = const T&;
using iterator_category = std::bidirectional_iterator_tag;
/**
* \brief
* Constructor of the iterator based on the iterator to child list
......@@ -589,7 +607,7 @@ private:
*
* \return vector of unary nodes constructed from the begin and end range
*/
template < std::input_iterator Iterator >
template < typename Iterator >
ext::vector < forward_tree > fromIterator ( Iterator begin, Iterator end ) {
ext::vector < forward_tree > res;
 
......
......@@ -28,6 +28,11 @@
 
#include <extensions/iterator.hpp>
 
#include <version>
#ifndef __cpp_lib_three_way_comparison
#include <extensions/compare.hpp>
#endif
namespace ext {
 
/**
......@@ -139,7 +144,7 @@ public:
*
* The iterator performs a top to bottom, left to right or depth first travrsal stopping at each node twice. Once as it enters it the first time and second time when it leaves it (on the way to its parent).
*/
class const_structure_iterator : public std::iterator < std::bidirectional_iterator_tag, T > {
class const_structure_iterator {
/**
* \brief
* The underlying iterator within some list of children.
......@@ -165,6 +170,12 @@ public:
bool isEnd;
 
public:
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = const T*;
using reference = const T&;
using iterator_category = std::bidirectional_iterator_tag;
/**
* \brief
* Constructor of the iterator based on the iterator to child list
......@@ -344,7 +355,7 @@ public:
*
* The prefix iterator is constructed as a wrapper over structure iterator, it selects only non-virtual nodes.
*/
class const_prefix_iterator : public std::iterator < std::bidirectional_iterator_tag, T > {
class const_prefix_iterator {
/**
* \brief
* The underlying structure iterator.
......@@ -352,6 +363,12 @@ public:
const_structure_iterator node;
 
public:
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = const T*;
using reference = const T&;
using iterator_category = std::bidirectional_iterator_tag;
/**
* \brief
* Constructor of the iterator based on the iterator to child list
......@@ -475,7 +492,7 @@ public:
*
* The prefix iterator is constructed as a wrapper over structure iterator, it selects only virtual nodes.
*/
class const_postfix_iterator : public std::iterator < std::bidirectional_iterator_tag, T > {
class const_postfix_iterator {
/**
* \brief
* The underlying structure iterator.
......@@ -483,6 +500,12 @@ public:
const_structure_iterator node;
 
public:
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = const T*;
using reference = const T&;
using iterator_category = std::bidirectional_iterator_tag;
/**
* \brief
* Constructor of the iterator based on the iterator to child list
......@@ -614,7 +637,7 @@ private:
*
* \return vector of unary nodes constructed from the begin and end range
*/
template < std::input_iterator Iterator >
template < class Iterator >
ext::vector < tree > fromIterator ( Iterator begin, Iterator end ) {
ext::vector < tree > res;
 
......
......@@ -915,13 +915,19 @@ auto end ( Container && cont ) -> decltype ( std::forward ( cont ).end ( ) ) {
* \tparam the type of value accepted by the callback. The type must include the reference and cv-qualification if needed.
*/
template < class T >
class callback_iterator : public std::iterator < std::output_iterator_tag, void, void, void, void > {
class callback_iterator {
/**
* The callback.
*/
T m_callback;
 
public:
using difference_type = void;
using value_type = void;
using pointer = void;
using reference = void;
using iterator_category = std::output_iterator_tag;
/**
* Constructor of the callback iterator based on callback
*
......
......@@ -70,8 +70,8 @@ TEST_CASE ( "Map", "[unit][std][container]" ) {
 
ext::reference_mover < ext::map < ext::reference_wrapper < Moveable >, Moveable > > && __range1 = ext::make_mover ( map );
 
ext::map_move_iterator < std::_Rb_tree_iterator < std::pair < const ext::reference_wrapper < Moveable >, Moveable > >, ext::reference_wrapper < Moveable >, Moveable > __begin1 = __range1.begin ( );
ext::map_move_iterator < std::_Rb_tree_iterator < std::pair < const ext::reference_wrapper < Moveable >, Moveable > >, ext::reference_wrapper < Moveable >, Moveable > __end1 =__range1.end ( );
auto __begin1 = __range1.begin ( );
auto __end1 =__range1.end ( );
 
for(; __begin1 != __end1; __begin1.operator++()) {
std::pair < ext::reference_wrapper < Moveable >, Moveable > && moveablePair = __begin1.operator*();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment