-
Notifications
You must be signed in to change notification settings - Fork 0
slice const_iterator
struct const_iterator : container::const_iterator
This structure inherits the base container's const_iterator which we'll call the base iterator
. The base iterator points to another iterator which we'll call the wrapped iterator
. This structure effectively makes the base iterator transparent so that interacting with this iterator is like interacting with the wrapped iterator.
-
typedef container::const_iterator::type iter_type
is a quick alias to the wrapped iterator. -
typedef elem_type<container::const_iterator::type>::type type
is an alias to the wrapped iterator's type so that generic wrappers can access the parent container'svalue_type
const_iterator()
The default constructor calls the default constructor of the base iterator.
const_iterator(const container::iterator ©)
A copy/conversion constructor calls the copy constructor of the base iterator.
operator bool()
checks the validity of both the base and wrapped iterator.
operator iter_type()
a conversion operator to get the wrapped iterator.
type &operator*()
returns the wrapped iterator's value.
type *operator->()
The dot operator for the wrapped iterator's value.
type *ptr()
returns a pointer to the wrapped iterator's value.
value &get()
returns the wrapped iterator's value.
container::iterator &ref()
Returns the base iterator.
const_iterator &operator++()
Increments to the next base iterator.
const_iterator &operator--()
Decrements to the previous base iterator.
const_iterator &operator+=(int n)
Increments the base iterator by n
.
const_iterator &operator-=(int n)
Decrements the base iterator by n
.
const_iterator operator+(int n)
Returns the base iterator n
elements ahead of this one.
const_iterator operator-(int n)
Returns the base iterator n
elements behind this one.
bool operator==(iterator i)
bool operator!=(iterator i)
bool operator==(const_iterator i)
bool operator!=(const_iterator i)
Comparison operations between iterators compares the base iterators.
int operator-(iterator i)
int operator-(const_iterator i)
Returns the number of elements between i
and this iterator.
slice<container> sub(int length)
slice<container> subcpy(int length)
Returns a slice starting at this iterator for a given length
.
slice<container> sub()
slice<container> subcpy()
Returns a slice from this iterator to the end of the container.
const_iterator &operator=(const_iterator i)
set the base iterator equal to another.