Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c7434b3

Browse filesBrowse files
authored
Merge pull request ryanhaining#45 from nvander1/remove_std_iterator
Remove use of std::iterator
2 parents e8fe728 + 2914ce2 commit c7434b3
Copy full SHA for c7434b3
Expand file treeCollapse file tree

24 files changed

+202
-56
lines changed
Open diff view settings
Collapse file

‎accumulate.hpp‎

Copy file name to clipboardExpand all lines: accumulate.hpp
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class iter::impl::Accumulator {
3939
Accumulator(Accumulator&&) = default;
4040

4141
template <typename ContainerT>
42-
class Iterator : public std::iterator<std::input_iterator_tag, AccumVal> {
42+
class Iterator {
4343
private:
4444
template <typename>
4545
friend class Iterator;
@@ -49,6 +49,12 @@ class iter::impl::Accumulator {
4949
std::unique_ptr<AccumVal> acc_val_;
5050

5151
public:
52+
using iterator_category = std::input_iterator_tag;
53+
using value_type = AccumVal;
54+
using difference_type = std::ptrdiff_t;
55+
using pointer = value_type*;
56+
using reference = value_type&;
57+
5258
Iterator(IteratorWrapper<ContainerT>&& sub_iter,
5359
IteratorWrapper<ContainerT>&& sub_end, AccumulateFunc& accumulate_fun)
5460
: sub_iter_{std::move(sub_iter)},
Collapse file

‎chain.hpp‎

Copy file name to clipboardExpand all lines: chain.hpp
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ class iter::impl::Chained {
100100
Chained(Chained&&) = default;
101101

102102
template <typename TupTypeT>
103-
class Iterator : public std::iterator<std::input_iterator_tag,
104-
typename IteratorData<TupTypeT>::TraitsValue> {
103+
class Iterator {
105104
private:
106105
using IterData = IteratorData<TupTypeT>;
107106
std::size_t index_;
@@ -116,6 +115,12 @@ class iter::impl::Chained {
116115
}
117116

118117
public:
118+
using iterator_category = std::input_iterator_tag;
119+
using value_type = typename IteratorData<TupTypeT>::TraitsValue;
120+
using difference_type = std::ptrdiff_t;
121+
using pointer = value_type*;
122+
using reference = value_type&;
123+
119124
Iterator(std::size_t i, typename IterData::IterTupType&& iters,
120125
typename IterData::IterTupType&& ends)
121126
: index_{i}, iters_(std::move(iters)), ends_(std::move(ends)) {
@@ -224,8 +229,7 @@ class iter::impl::ChainedFromIterable {
224229
public:
225230
ChainedFromIterable(ChainedFromIterable&&) = default;
226231
template <typename ContainerT>
227-
class Iterator : public std::iterator<std::input_iterator_tag,
228-
iterator_traits_deref<iterator_deref<ContainerT>>> {
232+
class Iterator {
229233
private:
230234
template <typename>
231235
friend class Iterator;
@@ -257,6 +261,12 @@ class iter::impl::ChainedFromIterable {
257261
}
258262

259263
public:
264+
using iterator_category = std::input_iterator_tag;
265+
using value_type = iterator_traits_deref<iterator_deref<ContainerT>>;
266+
using difference_type = std::ptrdiff_t;
267+
using pointer = value_type*;
268+
using reference = value_type&;
269+
260270
Iterator(IteratorWrapper<ContainerT>&& top_iter,
261271
IteratorWrapper<ContainerT>&& top_end)
262272
: top_level_iter_{std::move(top_iter)},
Collapse file

‎chunked.hpp‎

Copy file name to clipboardExpand all lines: chunked.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ class iter::impl::Chunker {
4141
public:
4242
Chunker(Chunker&&) = default;
4343
template <typename ContainerT>
44-
class Iterator
45-
: public std::iterator<std::input_iterator_tag, DerefVec<ContainerT>> {
44+
class Iterator {
4645
private:
4746
template <typename>
4847
friend class Iterator;
@@ -66,6 +65,12 @@ class iter::impl::Chunker {
6665
}
6766

6867
public:
68+
using iterator_category = std::input_iterator_tag;
69+
using value_type = DerefVec<ContainerT>;
70+
using difference_type = std::ptrdiff_t;
71+
using pointer = value_type*;
72+
using reference = value_type&;
73+
6974
Iterator(IteratorWrapper<ContainerT>&& sub_iter,
7075
IteratorWrapper<ContainerT>&& sub_end, std::size_t s)
7176
: sub_iter_{std::move(sub_iter)},
Collapse file

‎combinations.hpp‎

Copy file name to clipboardExpand all lines: combinations.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ class iter::impl::Combinator {
3737
public:
3838
Combinator(Combinator&&) = default;
3939
template <typename ContainerT>
40-
class Iterator : public std::iterator<std::input_iterator_tag,
41-
CombIteratorDeref<ContainerT>> {
40+
class Iterator {
4241
private:
4342
template <typename>
4443
friend class Iterator;
@@ -48,6 +47,12 @@ class iter::impl::Combinator {
4847
int steps_{};
4948

5049
public:
50+
using iterator_category = std::input_iterator_tag;
51+
using value_type = CombIteratorDeref<ContainerT>;
52+
using difference_type = std::ptrdiff_t;
53+
using pointer = value_type*;
54+
using reference = value_type&;
55+
5156
Iterator(ContainerT& container, std::size_t n)
5257
: container_p_{&container}, indices_{n} {
5358
if (n == 0) {
Collapse file

‎combinations_with_replacement.hpp‎

Copy file name to clipboardExpand all lines: combinations_with_replacement.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ class iter::impl::CombinatorWithReplacement {
3737
public:
3838
CombinatorWithReplacement(CombinatorWithReplacement&&) = default;
3939
template <typename ContainerT>
40-
class Iterator : public std::iterator<std::input_iterator_tag,
41-
CombIteratorDeref<ContainerT>> {
40+
class Iterator {
4241
private:
4342
template <typename>
4443
friend class Iterator;
@@ -48,6 +47,12 @@ class iter::impl::CombinatorWithReplacement {
4847
int steps_;
4948

5049
public:
50+
using iterator_category = std::input_iterator_tag;
51+
using value_type = CombIteratorDeref<ContainerT>;
52+
using difference_type = std::ptrdiff_t;
53+
using pointer = value_type*;
54+
using reference = value_type&;
55+
5156
Iterator(ContainerT& in_container, std::size_t n)
5257
: container_p_{&in_container},
5358
indices_(n, get_begin(in_container)),
Collapse file

‎compress.hpp‎

Copy file name to clipboardExpand all lines: compress.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class iter::impl::Compressed {
3333
public:
3434
Compressed(Compressed&&) = default;
3535
template <typename ContainerT, typename SelectorT>
36-
class Iterator : public std::iterator<std::input_iterator_tag,
37-
iterator_traits_deref<ContainerT>> {
36+
class Iterator {
3837
private:
3938
template <typename, typename>
4039
friend class Iterator;
@@ -57,6 +56,12 @@ class iter::impl::Compressed {
5756
}
5857

5958
public:
59+
using iterator_category = std::input_iterator_tag;
60+
using value_type = iterator_traits_deref<ContainerT>;
61+
using difference_type = std::ptrdiff_t;
62+
using pointer = value_type*;
63+
using reference = value_type&;
64+
6065
Iterator(IteratorWrapper<ContainerT>&& cont_iter,
6166
IteratorWrapper<ContainerT>&& cont_end,
6267
IteratorWrapper<SelectorT>&& sel_iter,
Collapse file

‎cycle.hpp‎

Copy file name to clipboardExpand all lines: cycle.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class iter::impl::Cycler {
3131
public:
3232
Cycler(Cycler&&) = default;
3333
template <typename ContainerT>
34-
class Iterator : public std::iterator<std::input_iterator_tag,
35-
iterator_traits_deref<ContainerT>> {
34+
class Iterator {
3635
private:
3736
template <typename>
3837
friend class Iterator;
@@ -41,6 +40,12 @@ class iter::impl::Cycler {
4140
IteratorWrapper<ContainerT> sub_end_;
4241

4342
public:
43+
using iterator_category = std::input_iterator_tag;
44+
using value_type = iterator_traits_deref<ContainerT>;
45+
using difference_type = std::ptrdiff_t;
46+
using pointer = value_type*;
47+
using reference = value_type&;
48+
4449
Iterator(IteratorWrapper<ContainerT>&& sub_iter,
4550
IteratorWrapper<ContainerT>&& sub_end)
4651
: sub_iter_{sub_iter},
Collapse file

‎dropwhile.hpp‎

Copy file name to clipboardExpand all lines: dropwhile.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class iter::impl::Dropper {
3333
public:
3434
Dropper(Dropper&&) = default;
3535
template <typename ContainerT>
36-
class Iterator : public std::iterator<std::input_iterator_tag,
37-
iterator_traits_deref<ContainerT>> {
36+
class Iterator {
3837
private:
3938
template <typename>
4039
friend class Iterator;
@@ -59,6 +58,12 @@ class iter::impl::Dropper {
5958
}
6059

6160
public:
61+
using iterator_category = std::input_iterator_tag;
62+
using value_type = iterator_traits_deref<ContainerT>;
63+
using difference_type = std::ptrdiff_t;
64+
using pointer = value_type*;
65+
using reference = value_type&;
66+
6267
Iterator(IteratorWrapper<ContainerT>&& sub_iter,
6368
IteratorWrapper<ContainerT>&& sub_end, FilterFunc& filter_func)
6469
: sub_iter_{std::move(sub_iter)},
Collapse file

‎enumerate.hpp‎

Copy file name to clipboardExpand all lines: enumerate.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,20 @@ class iter::impl::Enumerable {
6868
// index_. Each call to ++ increments both of these data members.
6969
// Each dereference returns an IterYield.
7070
template <typename ContainerT>
71-
class Iterator
72-
: public std::iterator<std::input_iterator_tag, IterYield<ContainerT>> {
71+
class Iterator {
7372
private:
7473
template <typename>
7574
friend class Iterator;
7675
IteratorWrapper<ContainerT> sub_iter_;
7776
Index index_;
7877

7978
public:
79+
using iterator_category = std::input_iterator_tag;
80+
using value_type = IterYield<ContainerT>;
81+
using difference_type = std::ptrdiff_t;
82+
using pointer = value_type*;
83+
using reference = value_type&;
84+
8085
Iterator(IteratorWrapper<ContainerT>&& sub_iter, Index start)
8186
: sub_iter_{std::move(sub_iter)}, index_{start} {}
8287

Collapse file

‎filter.hpp‎

Copy file name to clipboardExpand all lines: filter.hpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ class iter::impl::Filtered {
4444
Filtered(Filtered&&) = default;
4545

4646
template <typename ContainerT>
47-
class Iterator : public std::iterator<std::input_iterator_tag,
48-
iterator_traits_deref<ContainerT>> {
47+
class Iterator {
4948
protected:
5049
template <typename>
5150
friend class Iterator;
@@ -71,6 +70,12 @@ class iter::impl::Filtered {
7170
}
7271

7372
public:
73+
using iterator_category = std::input_iterator_tag;
74+
using value_type = iterator_traits_deref<ContainerT>;
75+
using difference_type = std::ptrdiff_t;
76+
using pointer = value_type*;
77+
using reference = value_type&;
78+
7479
Iterator(IteratorWrapper<ContainerT>&& sub_iter,
7580
IteratorWrapper<ContainerT>&& sub_end, FilterFunc& filter_func)
7681
: sub_iter_{std::move(sub_iter)},

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.