std::size_t
De cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Déclaré dans l'en-tête <cstddef> | ||
Déclaré dans l'en-tête <cstdio> | ||
Déclaré dans l'en-tête <cstring> | ||
Déclaré dans l'en-tête <ctime> | ||
typedef/*implementation-defined*/ size_t; | ||
std::size_t est du type entier non signé du résultat de l'opérateur et l'opérateur sizeofalignof .
Original:
std::size_t is the unsigned integer type of the result of the sizeof operator and the alignof operator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifier]Notes
size_t peut stocker la taille maximale d'un objet théoriquement possible de tout type (y compris tableau). Sur de nombreuses plateformes (à l'exception des systèmes avec adressage segmenté ) std :: size_t peut stocker en toute sécurité la valeur d'un pointeur non-membre, auquel cas il est synonyme de std::uintptr_t .
Original:
size_t can store the maximum size of a theoretically possible object of any type (including array). On many platforms (an exception are systems with segmented addressing) std::size_t can safely store the value of any non-member pointer, in which case it is synonymous with std::uintptr_t.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
std::size_t est couramment utilisé pour l'indexation et la matrice de comptage de boucle. Les programmes qui utilisent d'autres types, tels que unsignedint, pour l'indexation de tableau peut échouer sur, par exemple, les Systèmes 64-bit lorsque l'indice dépasse UINT_MAX ou si elle s'appuie sur de l'arithmétique 32-bit modulaire.
Original:
std::size_t is commonly used for array indexing and loop counting. Programs that use other types, such as unsignedint, for array indexing may fail on, e.g. 64-bit systems when the index exceeds UINT_MAX or if it relies on 32-bit modular arithmetic.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Lors de l'indexation C++, tels que des conteneurs std::string, std::vector, etc, du type approprié est l'élément size_type typedef fourni par de tels conteneurs. Il est généralement définie comme un synonyme de std::size_t .
Original:
When indexing C++ containers, such as std::string, std::vector, etc, the appropriate type is the member typedef size_type provided by such containers. It is usually defined as a synonym for std::size_t.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifier]Exemple
#include <cstddef>int main(){const std::size_t N =100;int* a = new int[N];for(std::size_t n =0; n<N;++n) a[n]= n; delete[] a;}
[modifier]Voir aussi
type entier signé retourné lorsque la soustraction de deux pointeurs Original: signed integer type returned when subtracting two pointers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (typedef) | |
décalage d'octet à partir du début d'un type standard à disposition élément spécifié Original: byte offset from the beginning of a standard-layout type to specified member The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction macro) |