const_iterator_pro¶
Const iterator of vector_pro¶
You can get one by calling vector_pro::cbegin, vector_pro::cend, vector_pro::crbegin or vector_pro::rend .
The return value will be an const_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 const data.
Keep in mind that the type of the
reverse const iteratoris alsoconst_iterator_probut will move in an opposite way.Additionally, using
const_iterator_profor any operations or data access will not throw exceptions. Please ensure that memory errors will not occur when using it.See also
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.
const_iterator_pro operator++();
const_iterator_pro operator--();
// 5.
const_iterator_pro operator++(int);
const_iterator_pro operator--(int);
// 6.
const_iterator_pro operator+(const int step);
const_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.
const value_type& operator*();
- Obtain the index of the data pointed to by
const_iterator_proin its container. - Obtain the data of the container that
const_iterator_propoints to. - Whether the iterator is a reverse iterator.
- Return itself after moving the
const_iterator_proby one step. - Return itself before moving the
const_iterator_proby one step - Move the
const_iterator_proby a specified number of steps. - Whether the two
const_iterator_pros point to the same data. - Access the const data.
If the iterator is a reversed one, both
++/--and+/-will movebackward/forward.Note that a
vector_procan convert into aconst_iterator_pro, while the opposite is not true.
Example¶
See more in vector_pro::cbegin, vector_pro::cend, vector_pro::crbegin and vector_pro::rend .