std::polymorphic<T, Allocator>:: operator=
From cppreference.net
<
cpp
|
memory
|
polymorphic
|
constexpr
polymorphic
&
operator
=
(
const
polymorphic
&
other
)
;
|
(1) | (自 C++26 起) |
|
constexpr
polymorphic
&
operator
=
(
polymorphic
&&
other
)
noexcept ( /* 见下文 */ ) ; |
(2) | (自 C++26 起) |
将 * this 的内容替换为 other 的内容。
令
traits
为
std::
allocator_traits
<
Allocator
>
:
1)
若
std::
addressof
(
other
)
==
this
为
true
,则不执行任何操作。否则,令
need_update
为
traits
::
propagate_on_container_copy_assignment
::
value
:
2)
若
std::
addressof
(
other
)
==
this
为
true
,则不执行任何操作。否则,令
need_update
为
traits
::
propagate_on_container_move_assignment
::
value
:
若满足以下所有条件,则程序非良构:
- std:: allocator_traits < Allocator > :: is_always_equal :: value 为 false 。
-
T是不完整类型。
目录 |
参数
| 其他 | - |
另一个
polymorphic
对象,其拥有的值(如果存在)将用于赋值
|
返回值
* this
异常
1)
如果抛出任何异常,对
*
this
不会产生任何影响。
2)
若抛出任何异常,对
*
this
或
other
均不产生任何影响。
noexcept
规范:
noexcept
(
std::
allocator_traits
<
Allocator
>
::
propagate_on_container_move_assignment
::
value
示例
|
本节内容不完整
原因:缺少示例 |