I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com

Forward Iterator

Forward iterator may store and retrieve values
+ View version details

Key Facts

Gyroscopic Couple: The rate of change of angular momentum (\inline \tau) = \inline I\omega\Omega (In the limit).
  • \inline I = Moment of Inertia.
  • \inline \omega = Angular velocity
  • \inline \Omega = Angular velocity of precession.

Blaise Pascal (1623-1662) was a French mathematician, physicist, inventor, writer and Catholic philosopher.

Leonhard Euler (1707-1783) was a pioneering Swiss mathematician and physicist.


Forward iterators are made for sequential access for list, set, multiset, map, and multimap.

Forward iterators have all the abilities of input iterators and most of those of output iterators like in the table below.

Note! You can make multiple copies of a forward iterator, each of which can be dereferenced and incremented independently.


Expression Description
*i Provides read access to the actual element
i->m Provides read access to a member of the actual element
++i Steps forward and returns new position (when not null)
i++ Steps forward and returns old position (when not null)
i1==i2 Returns if i1 is equal to i2
i1!=i2 Returns if i1 is not equal to i2
TYPE() Creates iterator (default constructor)
TYPE(i) Copies iterator (copy constructor)
i1=i2 Assigns an iterator


Example - hash_set member functions
This program illustrates a hash_set including a default constructor and the insert(), begin(), erase() member functions of the STL hash_set interface.
#include <iostream>
#include <hash_set>
using namespace std;
using namespace stdext;
int main
  hash_set <int> hs1;
  hash_set <int>::iterator hs1_Iter;
  hash_set <int>::const_iterator hs1_cIter;
  hs1.insert( 1 );
  hs1.insert( 2 );
  hs1.insert( 3 );
  hs1_Iter = hs1.begin( );
  cout <<"The first element of hs1 is "<<*hs1_Iter<<endl;
  hs1_Iter = hs1.begin( );
  hs1.erase( hs1_Iter );
  // The following 2 lines would err because the iterator is const
  // hs1_cIter = hs1.begin( );
  // hs1.erase( hs1_cIter );
  hs1_cIter = hs1.begin( );
  cout <<"The first element of hs1 is now "<<*hs1_cIter<<endl;
  return 0;

The first element of hs1 is 1
The first element of hs1 is now 2