iterator_pro¶
Iterator of vector_pro¶
You can get one by calling vector_pro::begin, vector_pro::end, vector_pro::rbegin or vector_pro::rend .
The return value will be an iterator_pro points to the beginning, end, reverse beginning and reverse end of the of the sequence respectively.
By using the dereference operator * you can access the data.
Keep in mind that the type of the
reverse iteratoris alsoiterator_probut will move in an opposite way.Also note that
iterator_proandstd::iteratorare not compatible.Additionally, using
iterator_profor any operations or data access will not throw exceptions. Please ensure that memory errors will not occur when using it.See also
const_iterator_pro.
Member functions¶
| name | notes |
|---|---|
| (constructor) | constructor (public member function) |
| (destructor) | destructor (public member function) |
// 1.
size_type get_idx() const;
// 2.
value_type** const get_data() const;
// 3.
bool get_reverse_flag() const;
// 4.
iterator_pro operator++();
iterator_pro operator--();
// 5.
iterator_pro operator++(int);
iterator_pro operator--(int);
// 6.
iterator_pro operator+(const int step);
iterator_pro operator-(const int step);
// 7.
bool operator==(const iterator_pro<value_type>& another) const;
bool operator!=(const iterator_pro<value_type>& another) const;
// 8.
value_type& operator*();
- Obtain the index of the data pointed to by
iterator_proin its container. - Obtain the data of the container that
iterator_propoints to. - Whether the iterator is a reverse iterator.
- Return itself after moving the
iterator_proby one step. - Return itself before moving the
iterator_proby one step - Move the
iterator_proby a specified number of steps. - Whether the two
iterator_pros point to the same data. - Access the data.
If the iterator is a reversed one, both
++/--and+/-will movebackward/forward.
Example¶
See more in vector_pro::begin, vector_pro::end, vector_pro::rbegin and vector_pro::rend .