해당 포스트는 cppreference.com을 참조해 작성했습니다.
std::array
- a container that encapsulates fixed size arrays.
- it doesn't decay to
T*automatically.
template<
class T,
std::size_t N
> struct array;
std::vector
- a sequence container that encapsualteds dynamic size arrays.
- Except for
std::vector<bool>partial specialization, the element are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets to regular pointers to elements. - Vectors usually occupy more space than static arrays, because more memory is allocated to handle future growth. This way a vector does not need to reallocate each time an element is inserted, buy only when the additional memory is exhausted.
template<
class T,
class Allocator = std::allocator<T>
> class vector;'Programming Language > cpp' 카테고리의 다른 글
| mergeSort (0) | 2025.10.13 |
|---|---|
| Is ++i better than i++? (0) | 2025.10.11 |