Skip to content

vector_pro::begin

C++
iterator_pro begin() noexcept;

Return iterator to beginning

Returns an iterator pointing to the first element in the vector.

If the container is empty, the returned iterator value shall not be dereferenced.

Parameters

none

Return value

An iterator to the beginning of the sequence container.

Example

C++
// vector_pro::begin/end
#include <iostream>
#include "vector_pro.h"

/**
 * Output:
 * myvector contains: 1 2 3 4 5
 */

int main ()
{
  vector_pro<int> myvector;
  for (int i=1; i<=5; i++) myvector.push_back(i);

  std::cout << "myvector contains:";
  for (iterator_pro<int> it = myvector.begin() ; it != myvector.end(); ++it)
    std::cout << ' ' << *it;
  std::cout << '\n';

  return 0;
}

Complexity

Constant.