   Help with Iterators and Algorithms
  Can anybody help in decribing what are iterators and algorithms,i dont quite understand what they are and what they are useful for.any help welcomed and links,thanks   
  An iterator is a way of accessing elements of an object without caring what the object is. For instance, you can use an iterator on a std::vector, std::map and std::list in exactly the same way, without caring what the object is. The main advantage is that you can change your object (container) and not have to go and re-write a bunch of code for it.Algorithms (Presuming you mean STL algorithms) use iterators so there doesn't have to be a copy of the code for a vector, a copy for a list, a copy for a map, etc.Examples of algorithms include sorting functions, finding functions, etc.Example:typedef std::vector<int> Container;Container c;for(int i=0; i<100; ++i){   c.insert(c.end(), rand());}std::sort(c.begin(), c.end());In the above code, you should be able to change the definition of "Container" to whatever you like and the code should behave exactly the same. Why would you want to do this? Well, if you're doing more complex stuff, a map might be better suited than a vector (Maps are good for lookup tables, vectors are good at random access, etc).   ;  I will give it a high level shot.  An iterator is just that, an iterator ;) The stl random iterators model the concept of a pointer.i.e.vector<type>::iterator it = myVector.begin();for( ; it != myVector.end(); ++it ) //do somethingis the same astype array[CONST_SIZE];type* it = array;for( ; it != array + CONST_SIZE; ++it ) //do somethingas you can see the vector just models an array.  But the iterator models the concept of the pointer which can be used like so in the std::sort// vector versionsort( myVecto.begin(), myVector.end(), SomePredicate );// array version, still using std::sortsort( array, array+CONST_SIZE, SomePredicate );The real power of doing this, is that any container that supports an iterator model of a pointer can be used with any stl algorithm.Does this help any?  I would suggest getting the book Generic Programming and the STL by Matthew H. Austen from Addsion Wesley   ;  thanks for the help,so are iterators for accessing things from a vector etc. and changing them, and using both iterators and algorithms can save time and space.thanks   ;  Basically yes... you would use iterators to access elements in the containers.  The C++ array type as a "built in iterator" if you will.. Then you can use the stl algorithms to massage your containers.. there's copy, sort, transform, search... just to name a few...   