std::size_t
Aus 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. |
| Defined in header <cstddef>
|
||
| Defined in header <cstdio>
|
||
| Defined in header <cstring>
|
||
| Defined in header <ctime>
|
||
| typedef /*implementation-defined*/ size_t; |
||
std::size_t ist die unsigned Integer-Typ des Ergebnisses der sizeof Betreiber und alignof Betreiber .
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.
[Bearbeiten] Notes
size_t speichern kann die maximale Größe einer theoretisch möglichen Objekt eines beliebigen Typs (einschließlich Array). Auf vielen Plattformen (eine Ausnahme sind Systeme mit segmentierten Adressierung) std :: size_t sicher speichern können den Wert eines Nicht-Mitglied Zeiger, in welchem Fall es gleichbedeutend mit std::uintptr_t ist .
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 wird häufig für Array-Indizierung und Loop-Zählung verwendet. Programme, die andere Arten, wie unsigned int, verwenden Sie für die Indizierung von Arrays kann auf zB nicht 64-Bit-Systemen, wenn der Index UINT_MAX übersteigt oder wenn es auf 32-Bit modulare Arithmetik setzt .
Original:
std::size_t is commonly used for array indexing and loop counting. Programs that use other types, such as unsigned int, 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.
Wenn Indexierung C + + Behältern wie std::string, std::vector, etc, die geeignete Art ist das Mitglied typedef size_type von solchen Behältern bereitgestellt. Es wird in der Regel als Synonym für std::size_t definiert .
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.
[Bearbeiten] Beispiel
#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; }
[Bearbeiten] Siehe auch
| Ganzzahl-Typ zurückgegeben, wenn die Subtraktion zweier Zeiger 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) | |
| Byte von dem Beginn eines Standard-Layout-Typ spezifiziert versetzt ist 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. (funktionieren Makro) | |