Calico
 All Classes Namespaces Files Functions Variables Typedefs Friends Groups
cal::input_iterator_base< Derived, T, Reference > Struct Template Reference

CRTP base type for implementing input iterators. More...

#include <iterator.hpp>

Public Types

typedef std::ptrdiff_t difference_type
 Difference type.
 
typedef std::input_iterator_tag iterator_category
 Iterator category.
 
typedef auto pointer
 Pointer type.
 
typedef Reference reference
 Reference type.
 
typedef T value_type
 Value type.
 

Public Member Functions

bool operator!= (const Derived &i) const
 Compares two iterators for inequality.
 
reference operator* () const
 Returns the pointed-to object.
 
Derived & operator++ (int)
 Increments the iterator and returns the previously pointed-to value.
 
pointer operator-> () const
 Member access of the object pointed to by the iterator.
 
bool operator== (const Derived &i) const
 Compares two iterators for equality.
 

Detailed Description

template<class Derived, class T = Derived, class Reference = T&>
struct cal::input_iterator_base< Derived, T, Reference >

CRTP base type for implementing input iterators.

The derived type is should implement the following operations:

bool operator==(const Derived&) const; // optional
Reference operator*() const; // optional
Derived& operator++();
  • If operator== is not implemented, it defaults to false (every iterator is distinct from each other).
  • If operator* is not implemented, it defaults to returning the iterator itself.