Calico
 All Classes Namespaces Files Functions Variables Typedefs Friends Groups
iterator.hpp File Reference

Some utility related to iterators. More...

#include <iterator>
#include <memory>
#include <stdexcept>
#include <type_traits>
#include "utility.hpp"

Classes

struct  cal::container_base< Derived, ConstIterator, Iterator, Size >
 CRTP base type for defining an mutable, iterable container. More...
 
struct  cal::counted_iterator< Iterator, Distance >
 An iterator adapter that counts the offset as the iterator moves. More...
 
struct  cal::input_iterator_base< Derived, T, Reference >
 CRTP base type for implementing input iterators. More...
 
struct  cal::integer_iterator< T, Tag >
 An RandomAccessIterator that stores an integer value of type T. The dereferenced value of the iterator is the integer itself. More...
 
struct  cal::iterator_range< InputIterator >
 An container-like type defined by a pair of iterators. More...
 
struct  cal::iterator_type< T >
 Returns the iterator type of the given container-like type. More...
 
struct  cal::transform_iterator< InputIterator, UnaryOperation >
 An iterator that applies a function to each element. More...
 

Namespaces

 cal
 Primary namespace.
 

Typedefs

template<class T >
using cal::iterator_type_t = iterator_type< T >::type
 

Functions

template<class Container >
auto cal::index_range (const Container &c)
 Returns the range of indices in a container.
 
template<class T >
iterator_range
< integer_iterator< T > > 
cal::integer_range (const T &end)
 Returns the range of integers in T() (inclusive) to end (exclusive).
 
template<class T >
iterator_range
< integer_iterator< T > > 
cal::integer_range (const T &begin, const T &end)
 Returns the range of integers in begin (inclusive) to end (exclusive).
 
template<class Iterator >
counted_iterator< Iterator > cal::iterator_counter (const Iterator &iterator, counted_iterator< Iterator >::difference_type init_count=counted_iterator< Iterator >::difference_type())
 Constructs a counted_iterator with an initial count. More...
 
template<class InputIterator >
iterator_range< InputIterator > cal::make_range (const InputIterator &first, const InputIterator &last)
 Constructs an iterator_range.
 
template<class InputIterator , class UnaryOperation >
transform_iterator
< InputIterator,
UnaryOperation > 
cal::make_transform_iterator (const InputIterator &it, const UnaryOperation &op)
 Constructs a transform_iterator.
 
template<class I , class J , class D , class E >
auto cal::operator!= (const counted_iterator< I, D > &i, const counted_iterator< J, E > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator!= (const I &i, const counted_iterator< J, D > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator!= (const counted_iterator< I, D > &i, const J &j)
 Compares the underlying iterators.
 
template<class I , class F >
auto cal::operator!= (const transform_iterator< I, F > &i, const transform_iterator< I, F > &j)
 Compares the underlying iterators.
 
template<class I , class D , class N >
auto cal::operator+ (const counted_iterator< I, D > &i, N n)
 Returns an iterator in which the underlying iterator and the counter are both advanced by n.
 
template<class I , class D , class N >
auto cal::operator+ (N n, const counted_iterator< I, D > &i)
 Returns an iterator advanced by the given number of steps.
 
template<class I , class F >
auto cal::operator+ (const transform_iterator< I, F > &i, transform_iterator< I, F >::difference_type n)
 Returns an iterator advanced by n.
 
template<class I , class F >
auto cal::operator+ (transform_iterator< I, F >::difference_type n, const transform_iterator< I, F > &i)
 Returns an iterator advanced by n.
 
template<class I , class D , class N >
auto cal::operator- (const counted_iterator< I, D > &i, N n)
 Returns an iterator in which the underlying iterator and the counter are both advanced by n in reverse.
 
template<class I , class J , class D , class E >
auto cal::operator- (const counted_iterator< I, D > &i, const counted_iterator< J, E > &j)
 Returns the distance between two iterators.
 
template<class I , class J , class D >
auto cal::operator- (const I &i, const counted_iterator< J, D > &j)
 Returns the distance between two iterators.
 
template<class I , class J , class D >
auto cal::operator- (const counted_iterator< I, D > &i, const J &j)
 Returns the distance between two iterators.
 
template<class I , class F >
auto cal::operator- (const transform_iterator< I, F > &i, transform_iterator< I, F >::difference_type n)
 Returns an iterator advanced by n in reverse.
 
template<class I , class F >
auto cal::operator- (const transform_iterator< I, F > &i, const transform_iterator< I, F > &j)
 Returns the distance between two iterators.
 
template<class I , class J , class D , class E >
auto cal::operator< (const counted_iterator< I, D > &i, const counted_iterator< J, E > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator< (const I &i, const counted_iterator< J, D > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator< (const counted_iterator< I, D > &i, const J &j)
 Compares the underlying iterators.
 
template<class I , class F >
auto cal::operator< (const transform_iterator< I, F > &i, const transform_iterator< I, F > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D , class E >
auto cal::operator<= (const counted_iterator< I, D > &i, const counted_iterator< J, E > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator<= (const I &i, const counted_iterator< J, D > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator<= (const counted_iterator< I, D > &i, const J &j)
 Compares the underlying iterators.
 
template<class I , class F >
auto cal::operator<= (const transform_iterator< I, F > &i, const transform_iterator< I, F > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D , class E >
auto cal::operator== (const counted_iterator< I, D > &i, const counted_iterator< J, E > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator== (const I &i, const counted_iterator< J, D > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator== (const counted_iterator< I, D > &i, const J &j)
 Compares the underlying iterators.
 
template<class I , class F >
auto cal::operator== (const transform_iterator< I, F > &i, const transform_iterator< I, F > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D , class E >
auto cal::operator> (const counted_iterator< I, D > &i, const counted_iterator< J, E > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator> (const I &i, const counted_iterator< J, D > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator> (const counted_iterator< I, D > &i, const J &j)
 Compares the underlying iterators.
 
template<class I , class F >
auto cal::operator> (const transform_iterator< I, F > &i, const transform_iterator< I, F > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D , class E >
auto cal::operator>= (const counted_iterator< I, D > &i, const counted_iterator< J, E > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator>= (const I &i, const counted_iterator< J, D > &j)
 Compares the underlying iterators.
 
template<class I , class J , class D >
auto cal::operator>= (const counted_iterator< I, D > &i, const J &j)
 Compares the underlying iterators.
 
template<class I , class F >
auto cal::operator>= (const transform_iterator< I, F > &i, const transform_iterator< I, F > &j)
 Compares the underlying iterators.
 
template<class Container >
auto cal::reverse_range (const Container &c)
 Reverses a container or iterator range. More...
 
template<class InputIterator , class UnaryOperation >
auto cal::transform (const InputIterator &first, const InputIterator &last, const UnaryOperation &op)
 Applies a given function to every element of an iterator range and returns the result as a lazily evaluated iterable container (i.e. the "map" function).
 
template<class Container , class UnaryOperation >
auto cal::transform (const Container &c, const UnaryOperation &op)
 Applies a given function to every element of an iterable container and returns the result as a lazily evaluated iterable container (i.e. the "map" function).
 

Detailed Description

Some utility related to iterators.