std::array
<array> 에 정의되어 있음.
|
||
template< class T, |
(since C++11) | |
std::array
is a container that encapsulates constant size arrays.
This container is an aggregate type with the same semantics as a struct holding a C-style array T[N] as its only non-static data member. It can be initialized with aggregate-initialization, given at most N
initializers that are convertible to T
: std::array<int, 3> a = {1,2,3};
The struct combines the performance and accessibility of a C-style array with the benefits of a standard container, such as knowing its own size, supporting assignment, random access iterators, etc.
There is a special case for a zero-length array (N == 0
). In that case, array.begin() == array.end(), which is some unique value. The effect of calling front() or back() on a zero-sized array is undefined.
An array can also be used as a tuple of N
elements of the same type.
목차 |
[편집] Member types
Member type | Definition |
value_type
|
T
|
size_type
|
std::size_t |
difference_type
|
std::ptrdiff_t |
reference
|
value_type&
|
const_reference
|
const value_type&
|
pointer
|
value_type* |