Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected depreciation of Iterator #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions include/tqdm/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ template <typename _Iterator>
Wrapper for pointers and std containter iterators.
@author Casper da Costa-Luis
*/
class MyIteratorWrapper
: public std::iterator<
std::forward_iterator_tag,
typename std::iterator_traits<_Iterator>::value_type> {
class MyIteratorWrapper{
public:
using iterator_category = std::forward_iterator_tag;
using value_type = typename std::iterator_traits<_Iterator>::value_type;
using difference_type = typename std::iterator_traits<_Iterator>::value_type;
using pointer = typename std::iterator_traits<_Iterator>::value_type*;
using reference = typename std::iterator_traits<_Iterator>::value_type&;

mutable _Iterator p; // TODO: remove this mutable

public:
// already done by std::iterator
typedef typename std::iterator_traits<_Iterator>::value_type value_type;

explicit MyIteratorWrapper(_Iterator x) : p(x) {}
// default construct gives end
Expand Down Expand Up @@ -147,8 +148,13 @@ _MyIteratorWrapper myIteratorWrapper(_Iterator x) {
}

template <typename IntType = int>
class RangeIterator
: public std::iterator<std::forward_iterator_tag, IntType> {
class RangeIterator{
public:
using iterator_category = std::forward_iterator_tag;
using value_type = IntType;
using difference_type = IntType;
using pointer = IntType*;
using reference = IntType&;
private:
mutable IntType current;
IntType total;
Expand Down