/20.CPP-MODULE-08

Containers templates de la STL, iterators and algorithms.

Primary LanguageC++

20.-CPP-MODULE-08

La STL = Standard Template Library

Containers templates

Self-explanatory see the example

  • list
  • map
  • vector -> equivalent tableau
list<int>			lst;
list<int>::const_iterator	iter;
list<int>::const_iterator	itend = lst.end();
for (iter = lst.begin(); iter != itened; iter++)
{
	cout << *it << endl; 				// Deferencement possible	
}

Iterators

"Pointeurs pour les containers"
Plus d'informations dans le projet : Ft_containers

Algorithmes

#include <algorithm>
for_each(lst.begin(),lst.end(), display) 		// (iter, itend, fcn)