-
Notifications
You must be signed in to change notification settings - Fork 0
slice iterator
struct iterator : container::iterator
This structure inherits the base container's 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::iterator::type iter_type
is a quick alias to the wrapped iterator. -
typedef elem_type<container::iterator::type>::type type
is an alias to the wrapped iterator's type so that generic wrappers can access the parent container'svalue_type
iterator()
The default constructor calls the default constructor of the base iterator.
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.
iterator &operator++()
Increments to the next base iterator.
iterator &operator--()
Decrements to the previous base iterator.
iterator &operator+=(int n)
Increments the base iterator by n
.
iterator &operator-=(int n)
Decrements the base iterator by n
.
iterator operator+(int n)
Returns the base iterator n
elements ahead of this one.
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.
void swap(iterator i)
void swap(const_iterator i)
swap the values between these two iterators. The iterators are left unchanged.
iterator &operator=(iterator i)
set the base iterator equal to another.