<div class="t-tr-text">C + +の概念:<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">C++ concepts:</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> Container
提供: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. |
Container
は、他のオブジェクトを格納し、それに含まれるオブジェクトが使用するメモリの管理の世話をするために使用するオブジェクトです.Original:
A
Container
is an object used to store other objects and taking care of the management of the memory used by the objects it contains.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
コンテナ·タイプOriginal:C
Container typeThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
T
要素タイプOriginal:T
Element typeThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
a
、型b
のC
オブジェクトOriginal:a
,b
Objects of typeC
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[編集] タイプ
name | type | notes |
---|---|---|
value_type |
T | Destructible
|
reference |
lvalue of T | |
const_reference |
const lvalue of T | |
iterator |
iterator pointing to T | ForwardIterator convertible to const_iterator
|
const_iterator |
const iterator pointing to T | ForwardIterator
|
difference_type |
signed integer | must be the same as iterator_traits::difference_type for iterator and const_iterator
|
size_type |
unsigned integer | large enough to represent all positive values of difference_type
|
[編集] メソッドや演算子
expression | return type | semantics | conditions | complexity | |
---|---|---|---|---|---|
C(); | C | Creates an empty container | Post: u.empty() == true | Constant | |
C(a) | C | Create a copy of a |
Pre: T must be CopyInsertable Post: a == X(a) |
Linear | |
a = b | C& | All elements of a are destroyed or move assigned to elements of b |
Post: a == b | Linear | |
(&a)->~C() | void | Destroy all elements and free all memory | Linear | ||
a.begin() | (const_)iterator | Iterator to the first element | Constant | ||
a.end() | (const_)iterator | Iterator to one passed the last element | Constant | ||
a.cbegin()(C + + 11以来) | const_iterator | const_cast<const C&>(a).begin() | Constant | ||
a.cend()(C + + 11以来) | const_iterator | const_cast<const C&>(a).end() | Constant | ||
a == b | convertible to bool | Makes C EqualityComparable |
Pre: T must be EqualityComparable |
Linear | |
a != b | convertible to bool | !(a==b) | Linear | ||
a.swap(b) | void | exchanges the values of a and b | Constant[1][2] | ||
swap(a,b) | void | a.swap(b) | Constant[1] | ||
a.size() | size_type | distance(a.begin(),a.end()) | Constant[2] | ||
a.max_size() | size_type | b.size() where b is the largest possible container | Constant[2] | ||
a.empty() | convertible to bool | a.begin() == a.end() | Constant | ||
notes | |||||
[編集] コンテナデータ競合
実装は、配列修飾のための任意の再入保証を提供する必要はありません - それは
push_back
に安全ではありませんと同時にbegin
お読みください。しかし、同じ配列の異なる要素に含まれているオブジェクトの内容は(vector<bool>
を除く)は同時に変更されたときのデータの競合を避けるために必要です。言い換えれば、1よりも大きいサイズでvector<int>
ため、x[1] = 5
と*x.begin() = 10
データの競合は発生しません.Original:
Implementations are not required to provide any reentrancy guarantee for sequence modifications - it is not safe to
push_back
and read begin
concurrently. However, it is required to avoid data races when the contents of the contained object in different elements of the same sequence are modified concurrently (except for vector<bool>
). In other words, for a vector<int>
with size greater than 1, x[1] = 5
and *x.begin() = 10
will not result in a data race.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.
これらの機能も考慮する必要があります
const
:begin
、end
、rbegin
、rend
、front
、back
、data
、find
、lower_bound
、upper_bound
、equal_range
、at
、と、を除いAssociativeContainer
とUnorderedAssociativeContainer
、operator[]
。これらの関数のいずれかを呼び出すと同時にデータの競合は発生しません.Original:
These functions must also be considered
const
: begin
, end
, rbegin
, rend
, front
, back
, data
, find
, lower_bound
, upper_bound
, equal_range
, at
, and, except in AssociativeContainer
and UnorderedAssociativeContainer
, operator[]
. Calling any of these functions concurrently will not result in a data race.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
- T