Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion accumulate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class iter::impl::Accumulator {
Accumulator(Accumulator&&) = default;

template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag, AccumVal> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -49,6 +49,12 @@ class iter::impl::Accumulator {
std::unique_ptr<AccumVal> acc_val_;

public:
using iterator_category = std::input_iterator_tag;
using value_type = AccumVal;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter,
IteratorWrapper<ContainerT>&& sub_end, AccumulateFunc& accumulate_fun)
: sub_iter_{std::move(sub_iter)},
Expand Down
18 changes: 14 additions & 4 deletions chain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ class iter::impl::Chained {
Chained(Chained&&) = default;

template <typename TupTypeT>
class Iterator : public std::iterator<std::input_iterator_tag,
typename IteratorData<TupTypeT>::TraitsValue> {
class Iterator {
private:
using IterData = IteratorData<TupTypeT>;
std::size_t index_;
Expand All @@ -116,6 +115,12 @@ class iter::impl::Chained {
}

public:
using iterator_category = std::input_iterator_tag;
using value_type = typename IteratorData<TupTypeT>::TraitsValue;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(std::size_t i, typename IterData::IterTupType&& iters,
typename IterData::IterTupType&& ends)
: index_{i}, iters_(std::move(iters)), ends_(std::move(ends)) {
Expand Down Expand Up @@ -224,8 +229,7 @@ class iter::impl::ChainedFromIterable {
public:
ChainedFromIterable(ChainedFromIterable&&) = default;
template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
iterator_traits_deref<iterator_deref<ContainerT>>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand Down Expand Up @@ -257,6 +261,12 @@ class iter::impl::ChainedFromIterable {
}

public:
using iterator_category = std::input_iterator_tag;
using value_type = iterator_traits_deref<iterator_deref<ContainerT>>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& top_iter,
IteratorWrapper<ContainerT>&& top_end)
: top_level_iter_{std::move(top_iter)},
Expand Down
9 changes: 7 additions & 2 deletions chunked.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class iter::impl::Chunker {
public:
Chunker(Chunker&&) = default;
template <typename ContainerT>
class Iterator
: public std::iterator<std::input_iterator_tag, DerefVec<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -66,6 +65,12 @@ class iter::impl::Chunker {
}

public:
using iterator_category = std::input_iterator_tag;
using value_type = DerefVec<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter,
IteratorWrapper<ContainerT>&& sub_end, std::size_t s)
: sub_iter_{std::move(sub_iter)},
Expand Down
9 changes: 7 additions & 2 deletions combinations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class iter::impl::Combinator {
public:
Combinator(Combinator&&) = default;
template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
CombIteratorDeref<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -48,6 +47,12 @@ class iter::impl::Combinator {
int steps_{};

public:
using iterator_category = std::input_iterator_tag;
using value_type = CombIteratorDeref<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(ContainerT& container, std::size_t n)
: container_p_{&container}, indices_{n} {
if (n == 0) {
Expand Down
9 changes: 7 additions & 2 deletions combinations_with_replacement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class iter::impl::CombinatorWithReplacement {
public:
CombinatorWithReplacement(CombinatorWithReplacement&&) = default;
template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
CombIteratorDeref<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -48,6 +47,12 @@ class iter::impl::CombinatorWithReplacement {
int steps_;

public:
using iterator_category = std::input_iterator_tag;
using value_type = CombIteratorDeref<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(ContainerT& in_container, std::size_t n)
: container_p_{&in_container},
indices_(n, get_begin(in_container)),
Expand Down
9 changes: 7 additions & 2 deletions compress.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class iter::impl::Compressed {
public:
Compressed(Compressed&&) = default;
template <typename ContainerT, typename SelectorT>
class Iterator : public std::iterator<std::input_iterator_tag,
iterator_traits_deref<ContainerT>> {
class Iterator {
private:
template <typename, typename>
friend class Iterator;
Expand All @@ -57,6 +56,12 @@ class iter::impl::Compressed {
}

public:
using iterator_category = std::input_iterator_tag;
using value_type = iterator_traits_deref<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& cont_iter,
IteratorWrapper<ContainerT>&& cont_end,
IteratorWrapper<SelectorT>&& sel_iter,
Expand Down
9 changes: 7 additions & 2 deletions cycle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class iter::impl::Cycler {
public:
Cycler(Cycler&&) = default;
template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
iterator_traits_deref<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -41,6 +40,12 @@ class iter::impl::Cycler {
IteratorWrapper<ContainerT> sub_end_;

public:
using iterator_category = std::input_iterator_tag;
using value_type = iterator_traits_deref<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter,
IteratorWrapper<ContainerT>&& sub_end)
: sub_iter_{sub_iter},
Expand Down
9 changes: 7 additions & 2 deletions dropwhile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class iter::impl::Dropper {
public:
Dropper(Dropper&&) = default;
template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
iterator_traits_deref<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -59,6 +58,12 @@ class iter::impl::Dropper {
}

public:
using iterator_category = std::input_iterator_tag;
using value_type = iterator_traits_deref<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter,
IteratorWrapper<ContainerT>&& sub_end, FilterFunc& filter_func)
: sub_iter_{std::move(sub_iter)},
Expand Down
9 changes: 7 additions & 2 deletions enumerate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,20 @@ class iter::impl::Enumerable {
// index_. Each call to ++ increments both of these data members.
// Each dereference returns an IterYield.
template <typename ContainerT>
class Iterator
: public std::iterator<std::input_iterator_tag, IterYield<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
IteratorWrapper<ContainerT> sub_iter_;
Index index_;

public:
using iterator_category = std::input_iterator_tag;
using value_type = IterYield<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter, Index start)
: sub_iter_{std::move(sub_iter)}, index_{start} {}

Expand Down
9 changes: 7 additions & 2 deletions filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class iter::impl::Filtered {
Filtered(Filtered&&) = default;

template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
iterator_traits_deref<ContainerT>> {
class Iterator {
protected:
template <typename>
friend class Iterator;
Expand All @@ -71,6 +70,12 @@ class iter::impl::Filtered {
}

public:
using iterator_category = std::input_iterator_tag;
using value_type = iterator_traits_deref<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter,
IteratorWrapper<ContainerT>&& sub_end, FilterFunc& filter_func)
: sub_iter_{std::move(sub_iter)},
Expand Down
18 changes: 14 additions & 4 deletions groupby.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class iter::impl::GroupProducer {

public:
template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
KeyGroupPair<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -70,6 +69,12 @@ class iter::impl::GroupProducer {
std::unique_ptr<KeyGroupPair<ContainerT>> current_key_group_pair_;

public:
using iterator_category = std::input_iterator_tag;
using value_type = KeyGroupPair<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter,
IteratorWrapper<ContainerT>&& sub_end, KeyFunc& key_func)
: sub_iter_{std::move(sub_iter)},
Expand Down Expand Up @@ -208,8 +213,7 @@ class iter::impl::GroupProducer {
other.completed = true;
}

class GroupIterator : public std::iterator<std::input_iterator_tag,
iterator_traits_deref<ContainerT>> {
class GroupIterator {
private:
std::remove_reference_t<key_func_ret<ContainerT>>* key_;
Group* group_p_;
Expand All @@ -220,6 +224,12 @@ class iter::impl::GroupProducer {
}

public:
using iterator_category = std::input_iterator_tag;
using value_type = iterator_traits_deref<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

// TODO template this? idk if it's relevant here
GroupIterator(Group* group_p, key_func_ret<ContainerT>& key)
: key_{&key}, group_p_{group_p} {}
Expand Down
10 changes: 6 additions & 4 deletions internal/iteratoriterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ namespace iter {
: std::true_type {};

template <typename TopIter>
class IteratorIterator
: public std::iterator<std::random_access_iterator_tag,
typename std::remove_reference<decltype(
**std::declval<TopIter>())>::type> {
class IteratorIterator {
template <typename> friend class IteratorIterator;
using Diff = std::ptrdiff_t;
static_assert(
Expand All @@ -39,6 +36,11 @@ namespace iter {
TopIter sub_iter;

public:
using iterator_category = std::random_access_iterator_tag;
using value_type = std::remove_reference_t<decltype(**std::declval<TopIter>())>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
IteratorIterator() = default;
IteratorIterator(const TopIter& it) : sub_iter{it} {}

Expand Down
9 changes: 7 additions & 2 deletions permutations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class iter::impl::Permuter {
Permuter(Permuter&&) = default;

template <typename ContainerT>
class Iterator
: public std::iterator<std::input_iterator_tag, Permutable<ContainerT>> {
class Iterator {
private:
template <typename>
friend class Iterator;
Expand All @@ -53,6 +52,12 @@ class iter::impl::Permuter {
int steps_{};

public:
using iterator_category = std::input_iterator_tag;
using value_type = Permutable<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(IteratorWrapper<ContainerT>&& sub_iter,
IteratorWrapper<ContainerT>&& sub_end)
: steps_{sub_iter != sub_end ? 0 : COMPLETE} {
Expand Down
9 changes: 7 additions & 2 deletions powerset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class iter::impl::Powersetter {
Powersetter(Powersetter&&) = default;

template <typename ContainerT>
class Iterator : public std::iterator<std::input_iterator_tag,
CombinatorType<ContainerT>> {
class Iterator {
private:
#if 0
template <typename> friend class Iterator;
Expand All @@ -50,6 +49,12 @@ class iter::impl::Powersetter {
iterator_type<CombinatorType<ContainerT>> comb_end_;

public:
using iterator_category = std::input_iterator_tag;
using value_type = CombinatorType<ContainerT>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(ContainerT& container, std::size_t sz)
: container_p_{&container},
set_size_{sz},
Expand Down
Loading