Skip to content

Les containers en C++ ont tous un usage particulier. Let's implement them.

Notifications You must be signed in to change notification settings

Abensett/21.-Ft_containers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ft_containers

Table of contents

Goal

Le but de ce projet est d'implémenter plusieurs containers C++ de la bibliothèque standard (Standard Template Library).

Vector

= 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.

Screenshot 2022-08-24 at 12 47 59

Stack

= 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 is removed from that end only

Map

= 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

Iterators are classified into five categories depending on the functionality they implement
Random Access Pointers are equivalent to standard pointers.

Screenshot 2022-08-24 at 13 12 18

image

Utils

  • 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);

To implement

The ones to do are vector, map, stack (mandatory) and set (bonus)

The ones to do are vector, map, stack (mandatory) and set (bonus)

image

42 Project 125/100

Resources

Somes questions

Releases

No releases published

Packages

No packages published