Le but de ce projet est d'implémenter plusieurs containers C++ de la bibliothèque standard (Standard Template Library).
= Dynamic contiguous array (SEQUENTIEL)
- Conteneur séquentiel qui encapsule les tableaux de taille dynamique.
- Les éléments sont stockés de façon contigüe, ce qui signifie que les éléments sont
accessibles non seulement via les itérateurs
, mais aussià partir des pointeurs
classiques sur un élément.
STD Properties
-
Sequence
Elements in sequence containers arenordered in a strict linear sequence. Individual elements are accessed by their position in this sequence. -
Dynamic array
Allows direct access to any element in the sequence, even through pointer arithmetics, and provides relatively fast addition/removal of elements at the end of the sequence. -
Allocator-aware
The container uses an allocator object to dynamically handle its storage needs.
= a type of container adaptors with LIFO(Last In First Out
- uses an encapsulated object of either vector or deque (by default) or list
- a new element is
added at one end
(top) and an element isremoved from that end only
= Binary Search Tree of key-value pairs, sorted by unique keys.
- Keys are sorted by using the comparison function Compare. Search, removal, and insertion
- Maps are usually implemented as
red-black trees
Iterators are classified into five categories depending on the functionality they implement
Random Access Pointers are equivalent to standard pointers.
- enable_if : <bool B, class T > If B true : public member typedef T type; otherwise: there is no member typedef.
- lexicographical_compare : bool lexicographical_compare (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2)
- equal : check if two ranges are equal.
- pair : Class with 2 elements of type T1 and T2;
- make_paire : pair<T1,T2> make_pair (T1 x, T2 y);
The ones to do are vector, map, stack (mandatory) and set (bonus)
-
Vector
- Vector Infos
- Size = number of elements / Capacity = amount of total space before reallocation
- Traits give information, at the compilation, about certain types thanks to a generic base
- Why and how using traits
- Un itérateur != pointeur must define 5 required member types by specializing iterator_traits
-
Map
-
Utils