iterator template : iterator « STL Algorithms Iterator « C++ Tutorial






#include <vector>
#include <iterator>
#include <iostream>
using std::vector;
using std::cout;
using std::endl;

template <typename IteratorType>
void iteratorTraitsTest(IteratorType it)
{
  typename std::iterator_traits<IteratorType>::value_type temp;
  temp = *it;
  cout << temp << endl;
}

int main(int argc, char** argv)
{
  vector<int> v;
  v.push_back(5);
  iteratorTraitsTest(v.begin());

  return (0);
}








30.1.iterator
30.1.1.Advance the iterator
30.1.2.Find a value in map by key
30.1.3.iterator template
30.1.4.Convert iterator to reverse iterator