被制御シーケンスを置き換えます。
array <Value>% operator=(array <Value>% right);
パラメーター
- [right]
コピーするコンテナー。
解説
このメンバー演算子は、right の各要素を被制御シーケンスの対応する要素に代入した後、*this を返します。これを使用して、被制御シーケンスを right の被制御シーケンスのコピーに置き換えることができます。
使用例
// std_tr1__array__array_operator_as.cpp
// compile with: /EHsc
#include <array>
#include <iostream>
typedef std::array<int, 4> Myarray;
int main()
{
Myarray c0 = {0, 1, 2, 3};
// display contents " 0 1 2 3"
for (Myarray::const_iterator it = c0.begin();
it != c0.end(); ++it)
std::cout << " " << *it;
std::cout << std::endl;
Myarray c1;
c1 = c0;
// display copied contents " 0 1 2 3"
for (Myarray::const_iterator it = c1.begin();
it != c1.end(); ++it)
std::cout << " " << *it;
std::cout << std::endl;
return (0);
}
必要条件
ヘッダー : <array>
名前空間: std