Skip to content

vector_pro::cend

C++
const_iterator_pro<value_type> cend() const noexcept;

Return const_iterator to beginning

Returns a const_iterator_pro pointing to the past-the-end in the container.

Just like the 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::end, 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, this function returns the same as vector_pro::cbegin.

Parameters

none

Return value

A const_iterator_pro to the end 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.