std::flat_multiset<Key,Compare,KeyContainer>:: operator=
From cppreference.net
<
cpp
|
container
|
flat multiset
|
flat_multiset
&
operator
=
(
const
flat_multiset
&
other
)
;
|
(1) |
(C++23부터)
(암시적으로 선언됨) |
|
flat_multiset
&
operator
=
(
flat_multiset
&&
other
)
;
|
(2) |
(C++23부터)
(암시적으로 선언됨) |
|
flat_multiset
&
operator
=
(
std::
initializer_list
<
key_type
>
ilist
)
;
|
(3) | (C++23부터) |
컨테이너 어댑터의 내용을 주어진 인자의 내용으로 교체합니다.
1)
복사 할당 연산자. 내용을
other
의 내용 복사본으로 대체합니다. 효과적으로
c
=
other.
c
;
comp
=
other.
comp
;
를 호출합니다.
2)
이동 할당 연산자. 내용을
other
의 내용으로 이동 시맨틱을 사용하여 대체합니다. 효과적으로
c
=
std
::
move
(
other.
c
)
;
comp
=
std
::
move
(
other.
comp
)
;
를 호출합니다.
3)
내용을 초기화자 목록
ilist
로 식별된 내용으로 대체합니다.
목차 |
매개변수
| other | - | 다른 컨테이너 어댑터(소스로 사용) |
| ilist | - | 초기화 리스트(소스로 사용) |
반환값
* this
복잡도
1,2)
기본 컨테이너의
operator
=
와 동등합니다.
3)
*
this
와
ilist
의 크기에 선형적으로 비례합니다.
예제
이 코드 실행
#include <flat_set> #include <initializer_list> #include <print> int main() { std::flat_multiset<int> x{1, 2, 3}, y, z; const auto w = {4, 5, 6, 7}; std::println("Initially:"); std::println("x = {}", x); std::println("y = {}", y); std::println("z = {}", z); y = x; // overload (1) std::println("Copy assignment copies data from x to y:"); std::println("x = {}", x); std::println("y = {}", y); z = std::move(x); // overload (2) std::println("Move assignment moves data from x to z, modifying both x and z:"); std::println("x = {}", x); std::println("z = {}", z); z = w; // overload (3) std::println("Assignment of initializer_list w to z:"); std::println("w = {}", w); std::println("z = {}", z); }
출력:
Initially:
x = {1, 2, 3}
y = {}
z = {}
Copy assignment copies data from x to y:
x = {1, 2, 3}
y = {1, 2, 3}
Move assignment moves data from x to z, modifying both x and z:
x = {}
z = {1, 2, 3}
Assignment of initializer_list w to z:
w = {4, 5, 6, 7}
z = {4, 5, 6, 7}
참고 항목
flat_multiset
을 생성합니다
(public member function) |
|
|
내부 컨테이너를 교체합니다
(public member function) |