共用方式為


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