MySQL 8.3.0
Source Code Documentation
Gis_wkb_vector_const_iterator< T > Class Template Reference

Gis_wkb_vector_const_iterator is const_iterator class for Gis_wkb_vector, and base class of Gis_wkb_vector_iterator – iterator class for Gis_wkb_vector. More...

#include <spatial.h>

Inheritance diagram for Gis_wkb_vector_const_iterator< T >:
[legend]

Public Types

typedef T value_type
 
typedef ptrdiff_t difference_type
 
typedef difference_type distance_type
 
typedef owner_t::size_type size_type
 
typedef value_typereference
 This is the return type for operator[]. More...
 
typedef value_typepointer
 
typedef std::random_access_iterator_tag iterator_category
 

Public Member Functions

Constructors and destroctor

Do not construct iterators explicitly using these constructors, but call Gis_wkb_vector::begin() const to get an valid iterator.

See also
Gis_wkb_vector::begin() const
 Gis_wkb_vector_const_iterator (const self &vi)
 
 Gis_wkb_vector_const_iterator ()
 
 Gis_wkb_vector_const_iterator (index_type idx, const owner_t *owner)
 
 ~Gis_wkb_vector_const_iterator ()=default
 
Iterator comparison operators

The way to compare two iterators is to compare the index values of the two elements they point to.

The iterator sitting on an element with less index is regarded to be smaller. And the invalid iterator sitting after last element is greater than any other iterators, because it is assumed to have an index equal to last element's index plus one; The invalid iterator sitting before first element is less than any other iterators because it is assumed to have an index -1.

bool operator== (const self &itr) const
 Equality comparison operator. More...
 
bool operator!= (const self &itr) const
 Unequal compare, identical to !operator(==itr) More...
 
bool operator< (const self &itr) const
 Less than comparison operator. More...
 
bool operator<= (const self &itr) const
 Less equal comparison operator. More...
 
bool operator>= (const self &itr) const
 Greater equal comparison operator. More...
 
bool operator> (const self &itr) const
 Greater comparison operator. More...
 
Iterator movement operators.

When we talk about iterator movement, we think the container is a uni-directional range, represented by [begin, end), and this is true no matter we are using iterators or reverse iterators.

When an iterator is moved closer to "begin", we say it is moved backward, otherwise we say it is moved forward.

selfoperator++ ()
 Pre-increment. More...
 
self operator++ (int)
 Post-increment. More...
 
selfoperator-- ()
 Pre-decrement. More...
 
self operator-- (int)
 Post-decrement. More...
 
const selfoperator= (const self &itr)
 Assignment operator. More...
 
self operator+ (difference_type n) const
 Iterator movement operator. More...
 
const selfoperator+= (difference_type n)
 Move this iterator forward by n elements. More...
 
self operator- (difference_type n) const
 Iterator movement operator. More...
 
const selfoperator-= (difference_type n)
 Move this iterator backward by n elements. More...
 
difference_type operator- (const self &itr) const
 Iterator distance operator. More...
 

Protected Types

typedef Gis_wkb_vector_const_iterator< T > self
 
typedef Gis_wkb_vector< T > owner_t
 
typedef ptrdiff_t index_type
 

Functions that retrieve values from the iterator.

index_type m_curidx
 Current element's index, starting from 0. More...
 
owner_tm_owner
 The owner container of this iteraotr. More...
 
reference operator* () const
 Dereference operator. More...
 
pointer operator-> () const
 Arrow operator. More...
 
reference operator[] (difference_type offset) const
 Iterator index operator. More...
 
void move_by (self &itr, difference_type n, bool back) const
 

Detailed Description

template<typename T>
class Gis_wkb_vector_const_iterator< T >

Gis_wkb_vector_const_iterator is const_iterator class for Gis_wkb_vector, and base class of Gis_wkb_vector_iterator – iterator class for Gis_wkb_vector.

Template Parameters
TVector element type

Member Typedef Documentation

◆ difference_type

template<typename T >
typedef ptrdiff_t Gis_wkb_vector_const_iterator< T >::difference_type

◆ distance_type

template<typename T >
typedef difference_type Gis_wkb_vector_const_iterator< T >::distance_type

◆ index_type

template<typename T >
typedef ptrdiff_t Gis_wkb_vector_const_iterator< T >::index_type
protected

◆ iterator_category

template<typename T >
typedef std::random_access_iterator_tag Gis_wkb_vector_const_iterator< T >::iterator_category

◆ owner_t

template<typename T >
typedef Gis_wkb_vector<T> Gis_wkb_vector_const_iterator< T >::owner_t
protected

◆ pointer

template<typename T >
typedef value_type* Gis_wkb_vector_const_iterator< T >::pointer

◆ reference

template<typename T >
typedef value_type& Gis_wkb_vector_const_iterator< T >::reference

This is the return type for operator[].

◆ self

template<typename T >
typedef Gis_wkb_vector_const_iterator<T> Gis_wkb_vector_const_iterator< T >::self
protected

◆ size_type

template<typename T >
typedef owner_t::size_type Gis_wkb_vector_const_iterator< T >::size_type

◆ value_type

template<typename T >
typedef T Gis_wkb_vector_const_iterator< T >::value_type

Constructor & Destructor Documentation

◆ Gis_wkb_vector_const_iterator() [1/3]

template<typename T >
Gis_wkb_vector_const_iterator< T >::Gis_wkb_vector_const_iterator ( const self vi)
inline

◆ Gis_wkb_vector_const_iterator() [2/3]

template<typename T >
Gis_wkb_vector_const_iterator< T >::Gis_wkb_vector_const_iterator ( )
inline

◆ Gis_wkb_vector_const_iterator() [3/3]

template<typename T >
Gis_wkb_vector_const_iterator< T >::Gis_wkb_vector_const_iterator ( index_type  idx,
const owner_t owner 
)
inline

◆ ~Gis_wkb_vector_const_iterator()

template<typename T >
Gis_wkb_vector_const_iterator< T >::~Gis_wkb_vector_const_iterator ( )
default

Member Function Documentation

◆ move_by()

template<typename T >
void Gis_wkb_vector_const_iterator< T >::move_by ( self itr,
difference_type  n,
bool  back 
) const
inlineprotected

◆ operator!=()

template<typename T >
bool Gis_wkb_vector_const_iterator< T >::operator!= ( const self itr) const
inline

Unequal compare, identical to !operator(==itr)

Parameters
itrThe iterator to compare against.
Returns
False if this iterator equals to itr; True otherwise.

◆ operator*()

template<typename T >
reference Gis_wkb_vector_const_iterator< T >::operator* ( ) const
inline

Dereference operator.

Return the reference to the cached data element. The returned value can only be used to read its referenced element.

Returns
The reference to the element this iterator points to.

◆ operator+()

template<typename T >
self Gis_wkb_vector_const_iterator< T >::operator+ ( difference_type  n) const
inline

Iterator movement operator.

Return another iterator by moving this iterator forward by n elements.

Parameters
nThe amount and direction of movement. If negative, will move backward by |n| element.
Returns
The new iterator at new position.

◆ operator++() [1/2]

template<typename T >
self & Gis_wkb_vector_const_iterator< T >::operator++ ( )
inline

Pre-increment.

Move the iterator one element forward, so that the element it sits on has a bigger index. Use ++iter rather than iter++ where possible to avoid two useless iterator copy constructions.

Returns
This iterator after incremented.

◆ operator++() [2/2]

template<typename T >
self Gis_wkb_vector_const_iterator< T >::operator++ ( int  )
inline

Post-increment.

Move the iterator one element forward, so that the element it sits on has a bigger index. Use ++iter rather than iter++ where possible to avoid two useless iterator copy constructions.

Returns
A new iterator not incremented.

◆ operator+=()

template<typename T >
const self & Gis_wkb_vector_const_iterator< T >::operator+= ( difference_type  n)
inline

Move this iterator forward by n elements.

Parameters
nThe amount and direction of movement. If negative, will move backward by |n| element.
Returns
Reference to this iterator at new position.

◆ operator-() [1/2]

template<typename T >
difference_type Gis_wkb_vector_const_iterator< T >::operator- ( const self itr) const
inline

Iterator distance operator.

Return the index difference of this iterator and itr, so if this iterator sits on an element with a smaller index, this call will return a negative number.

Parameters
itrThe other iterator to subtract. itr can be the invalid iterator after last element or before first element, their index will be regarded as last element's index + 1 and -1 respectively.
Returns
The index difference.

◆ operator-() [2/2]

template<typename T >
self Gis_wkb_vector_const_iterator< T >::operator- ( difference_type  n) const
inline

Iterator movement operator.

Return another iterator by moving this iterator backward by n elements.

Parameters
nThe amount and direction of movement. If negative, will move forward by |n| element.
Returns
The new iterator at new position.

◆ operator--() [1/2]

template<typename T >
self & Gis_wkb_vector_const_iterator< T >::operator-- ( )
inline

Pre-decrement.

Move the iterator one element backward, so that the element it sits on has a smaller index. Use –iter rather than iter– where possible to avoid two useless iterator copy constructions.

Returns
This iterator after decremented.

◆ operator--() [2/2]

template<typename T >
self Gis_wkb_vector_const_iterator< T >::operator-- ( int  )
inline

Post-decrement.

Move the iterator one element backward, so that the element it sits on has a smaller index. Use –iter rather than iter– where possible to avoid two useless iterator copy constructions.

Returns
A new iterator not decremented.

◆ operator-=()

template<typename T >
const self & Gis_wkb_vector_const_iterator< T >::operator-= ( difference_type  n)
inline

Move this iterator backward by n elements.

Parameters
nThe amount and direction of movement. If negative, will move forward by |n| element.
Returns
Reference to this iterator at new position.

◆ operator->()

template<typename T >
pointer Gis_wkb_vector_const_iterator< T >::operator-> ( ) const
inline

Arrow operator.

Return the pointer to the cached data element. The returned value can only be used to read its referenced element.

Returns
The address of the referenced object.

◆ operator<()

template<typename T >
bool Gis_wkb_vector_const_iterator< T >::operator< ( const self itr) const
inline

Less than comparison operator.

Parameters
itrThe iterator to compare against.
Returns
True if this iterator is less than itr.

◆ operator<=()

template<typename T >
bool Gis_wkb_vector_const_iterator< T >::operator<= ( const self itr) const
inline

Less equal comparison operator.

Parameters
itrThe iterator to compare against.
Returns
True if this iterator is less than or equal to itr.

◆ operator=()

template<typename T >
const self & Gis_wkb_vector_const_iterator< T >::operator= ( const self itr)
inline

Assignment operator.

This iterator will point to the same key/data pair as itr, and have the same configurations as itr.

Parameters
itrThe right value of the assignment.
Returns
This iterator's reference.

◆ operator==()

template<typename T >
bool Gis_wkb_vector_const_iterator< T >::operator== ( const self itr) const
inline

Equality comparison operator.

Invalid iterators are equal; Valid iterators sitting on the same key/data pair equal; Otherwise not equal.

Parameters
itrThe iterator to compare against.
Returns
True if this iterator equals to itr; False otherwise.

◆ operator>()

template<typename T >
bool Gis_wkb_vector_const_iterator< T >::operator> ( const self itr) const
inline

Greater comparison operator.

Parameters
itrThe iterator to compare against.
Returns
True if this iterator is greater than itr.

◆ operator>=()

template<typename T >
bool Gis_wkb_vector_const_iterator< T >::operator>= ( const self itr) const
inline

Greater equal comparison operator.

Parameters
itrThe iterator to compare against.
Returns
True if this iterator is greater than or equal to itr.

◆ operator[]()

template<typename T >
reference Gis_wkb_vector_const_iterator< T >::operator[] ( difference_type  offset) const
inline

Iterator index operator.

Parameters
offsetThe offset of target element relative to this iterator.
Returns
Return the reference of the element which is at position *this + offset. The returned value can only be used to read its referenced element.

Member Data Documentation

◆ m_curidx

template<typename T >
index_type Gis_wkb_vector_const_iterator< T >::m_curidx
protected

Current element's index, starting from 0.

◆ m_owner

template<typename T >
owner_t* Gis_wkb_vector_const_iterator< T >::m_owner
protected

The owner container of this iteraotr.


The documentation for this class was generated from the following file: