std::deque<T,Allocator>:: append_range
|
template
<
container-compatible-range
<
T
>
R
>
void append_range ( R && rg ) ; |
(C++23부터)
(C++26부터 constexpr) |
|
rg
범위의 요소들을 비역순으로
end()
앞에 복사본을 삽입합니다.
모든 반복자(
end()
반복자 포함)가 무효화됩니다. 참조자는 무효화되지 않습니다.
rg 내의 각 반복자는 정확히 한 번 역참조됩니다.
목차 |
매개변수
| rg | - |
a
container compatible range
, that is, an
input_range
whose elements are convertible to
T
|
| Type requirements | ||
-
T
is not
EmplaceConstructible
into
deque
from
*
ranges::
begin
(
rg
)
, the behavior is undefined.
|
||
복잡도
rg
의 크기에 선형적입니다.
T
의 생성자 호출 횟수는 정확히
std
::
ranges::
size
(
rg
)
)
와 동일합니다.
예외
복사 생성자, 이동 생성자, 할당 연산자, 또는 이동 할당 연산자 이외의 이유로 예외가 발생한 경우, 아무런 효과가 없습니다. 양쪽 끝에 단일 요소를 삽입하는 동안 예외가 발생한 경우, 아무런 효과가 없습니다. 그 외의 경우, non-
CopyInsertable
T
의 이동 생성자에 의해 예외가 발생한 경우, 그 효과는 명시되지 않습니다.
참고 사항
| 기능 테스트 매크로 | 값 | 표준 | 기능 |
|---|---|---|---|
__cpp_lib_containers_ranges
|
202202L
|
(C++23) | Ranges-aware 생성 및 삽입 |
예제
#include <cassert> #include <deque> #include <list> int main() { auto head = std::deque{1, 2, 3, 4}; const auto tail = std::list{-5, -6, -7}; #ifdef __cpp_lib_containers_ranges head.append_range(tail); #else head.insert(head.end(), tail.cbegin(), tail.cend()); #endif assert((head == std::deque{1, 2, 3, 4, -5, -6, -7})); }
참고 항목
|
(C++23)
|
요소 범위를 시작 부분에 추가
(public member function) |
|
(C++23)
|
요소 범위를 삽입
(public member function) |
|
요소를 끝에 추가
(public member function) |
|
|
(C++11)
|
요소를 제자리에서 끝에 생성
(public member function) |