vector_pro::cbegin¶
Return const_iterator to beginning¶
Returns a const_iterator_pro pointing to the first element in the container.
Similar to const_iterator , which is an iterator that points to const content. This iterator can be increased and decreased (unless it is itself also const), just like the iterator_pro which is returned by vector_pro::begin, but it cannot be used to modify the contents it points to, even if the vector object is not itself const.
If the container is empty, the returned iterator value shall not be dereferenced.
Parameters¶
none
Return value¶
A const_iterator_pro to the beginning of the sequence.
Example¶
C++
// vector_pro::cbegin/cend
#include <iostream>
#include "vector_pro.h"
/**
* Output:
* myvector contains: 10 20 30 40 50
*/
int main ()
{
vector_pro<int> myvector = {10,20,30,40,50};
std::cout << "myvector contains:";
for (auto it = myvector.cbegin(); it != myvector.cend(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}
Complexity¶
Constant.