array::operator=

替换控件序列。

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

请参见

参考

<array>

array Class (TR1)

array::assign