std::size_t
提供: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_tsizeof演算子とalignof演算子の結果の符号なし整数型である.
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.
[編集] ノート
size_tの任意の型(配列を含む)の理論的に可能なオブジェクトの最大サイズを格納することができます。多くのプラットフォームでは(例外はセグメント化されたアドレッシングを持つシステムである)はstd :: size_tは安全に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一般に配列のインデックスとループカウントのために使用されます。配列のインデックス付けのためにそのようなunsigned intなどの別の型を、使用するプログラムは、例えば上で失敗することがあります64ビットシステムでは、32ビットモジュラー演算に依存している場合、インデックスがUINT_MAX超えたり.
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.
インデックスを作成する際に、C + +などの容器、std::string、std::vectorなど、適切なタイプはそのような容器で提供されるメンバのtypedefsize_typeです。これは通常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.
[編集] 例
#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; }
[編集] も参照してください
| 二つのポインタを減算したときに符号付き整数型が返されます 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です) | |
| バイトは、標準レイアウトの種類の先頭から指定されたメンバへのオフセット 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. (関数マクロ) | |