[ Web Proxy ]
URL:
Viewing: https://fr.cppreference.com/cpp/container/array [Back]  [Original]

std::array cppreference.com
cppreference.com
Espaces de noms
Variantes

std::array

De cppreference.com


 
 
 
std::array
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Elment d'accs
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::at
array::operator[]
array::front
array::back
array::data
Les itrateurs
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::begin
array::cbegin
array::end
array::cend
array::rbegin
array::crbegin
array::rend
array::crend
Capacit
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::empty
array::size
array::max_size
Modificateurs
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::fill
array::swap
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
get
swap
Classes d'aide
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple_size
tuple_element
 
<tbody> </tbody>
Dclar dans l'en-tte <array>
template< class T, std::size_t N > struct array;
(depuis C++11)

std::array est un conteneur qui encapsule des tableaux de taille constante (connue la compilation).

Cette structure possde la mme smantique de type agrgat qu'un tableau de style C. La taille et l'efficacit de array<T,N> pour un certain nombre d'lments sont quivalentes celles du tableau T[N] de style C correspondant. La structure offre les avantages d'un conteneur standard, telles que la connaissance du nombre d'lments contenus, le support de l'affectation, les itrateurs accs alatoire, etc.

Il existe un cas particulier pour un std::array de longueur zro (N == 0). Dans ce cas, array.begin() == array.end(), qui est une valeur unique. L'effet de l'appel de front() ou back() sur un tableau de taille zro est indfini .

Array est un agrgat (il n'a pas de constructeurs et aucun membre en priv ou protg), ce qui lui permet d'utiliser agrgat d'initialisation.

Un tableau peut aussi tre utilis comme un n-uplet de N lments du mme type.

Types membres

Type membre Definition
value_type T [edit]
size_type size_t [edit]
difference_type ptrdiff_t [edit]
reference value_type& [edit]
const_reference const value_type& [edit]
pointer T*[edit]
const_pointer const T*[edit]
iterator RandomAccessIterator [edit]
const_iterator Itrateur constant accs alatoire [edit]
reverse_iterator std::reverse_iterator<iterator> [edit]
const_reverse_iterator std::reverse_iterator<const_iterator> [edit]

Fonctions membres

Accs aux lments
accde l'lment spcifi avec vrification de bornes
(fonction membre publique) [edit]
accde l'lment spcifi
(fonction membre publique) [edit]
accde au premier lment
(fonction membre publique) [edit]
accde au dernier lment
(fonction membre publique) [edit]
(C++11)
accde directement au tableau sous-jacent
(fonction membre publique) [edit]
Itrateurs
retourne un itrateur au dbut
Original:
returns an iterator to the beginning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
retourne un itrateur la fin
Original:
returns an iterator to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
retourne un itrateur invers au dbut
(fonction membre publique) [edit]
retourne un itrateur invers la fin
(fonction membre publique) [edit]
Capacit
vrifie si le conteneur est vide
Original:
checks whether the container is empty
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
retourne le nombre d'lments
Original:
returns the number of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
retourne le plus grand nombre possible d'lments
Original:
returns the maximum possible number of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
Oprations
remplir le rcipient avec la valeur spcifie
Original:
fill the container with specified value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
permute les contenus
Original:
swaps the contents
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]

Fonctions tiers

compare lexicographiquement les valeurs dans le array
Original:
lexicographically compares the values in the array
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction gnrique) [edit]
accesses an element of an array
(fonction gnrique) [edit]
l'algorithme spcialis std::swap
Original:
specializes the std::swap algorithm
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction gnrique) [edit]

Classes d'aide

obtient la taille d'une array
Original:
obtains the size of an array
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe gnrique spcialise) [edit]
obtient le type des lments de array
Original:
obtains the type of the elements of array
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe gnrique spcialise) [edit]

Exemple

#include <string>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <array>

int main()
{
    // La construction utilise l'aggrgat d'initialisation
    std::array<int, 3> a1{ {1,2,3} };    // Double accolades requises
    std::array<int, 3> a2 = {1, 2, 3}; // sauf aprs un =
    std::array<std::string, 2> a3 = { {std::string("a"), "b"} };

    // Les oprations sur les conteneurs sont supportes
    std::sort(a1.begin(), a1.end());
    std::reverse_copy(a2.begin(), a2.end(), std::ostream_iterator<int>(std::cout, " "));

    // La boucle "ranged for" est supporte
    for(auto& s: a3)
        std::cout << s << ' ';
}



Web Proxy Viewer  |  New URL  |  Original Page