std::stack operator=
- 自 C++11 起
- 直到 C++11
// (1) Non const version only
stack& operator=( const stack& other );
// (2) Non const version only
stack& operator=( stack&& other );
// (1) Non const version only
stack& operator=( const stack& other );
用 other
的内容替换容器适配器的内容。
-
(1)
复制赋值运算符。用other
内容的副本替换内容。实际调用
c = other.c
-
(2)
移动赋值运算符。使用移动语义替换为其他内容。实际调用
c = std::move(other.c)
注意
两个运算符都是隐式声明的,这意味着 Container
必须是可复制/可移动的才能生成它们。
参数
other
- 用作数据源的另一个容器适配器
返回值
对容器 *this
的引用。
异常
等同于底层容器的 operator=
。
复杂度
等同于底层容器的 operator=
。
示例
重要
本节需要改进。您可以通过编辑此文档页面来帮助我们。