std::inplace_vector<T,N>:: capacity
From cppreference.net
<
cpp
|
container
|
inplace vector
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::inplace_vector
| Member types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
static
constexpr
size_type capacity
(
)
noexcept
;
|
(C++26부터) | |
내부(인플레이스) 저장소의 용량을 반환합니다. 다음 코드와 동일합니다: return N ; .
목차 |
매개변수
(없음)
반환값
컨테이너가 보유할 수 있는 최대 요소 개수입니다.
복잡도
상수.
참고 사항
각
std::
inplace_vector
<
T, N
>
는 고정 용량 컨테이너이므로,
capacity
가 반환하는 값은
N
과 동일합니다(이는 또한
max_size()
가 반환하는 값이기도 합니다).
예제
이 코드 실행
#include <inplace_vector> int main() { constexpr std::inplace_vector<int, 4> v1; static_assert(v1.capacity() == 4 && v1.max_size() == 4); constexpr std::inplace_vector<int, 0> v2; static_assert(v2.capacity() == 0 && v2.max_size() == 0); }
참고 항목
|
[static]
|
가능한 최대 원소 개수를 반환합니다
(public static member function) |
|
원소의 개수를 반환합니다
(public member function) |
|
|
저장된 원소의 개수를 변경합니다
(public member function) |
|
|
컨테이너가 비어 있는지 확인합니다
(public member function) |
|
|
[static]
|
저장 공간을 예약합니다
(public static member function) |