array::begin

指定受控序列的开头。

iterator begin();
const_iterator begin() const;

备注

成员函数返回序列中的第一个点。元素的随机访问迭代器 (或受一个空序列。结束)。

示例

 

// std_tr1__array__array_begin.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; 
 
// display first element " 0" 
    Myarray::iterator it2 = c0.begin(); 
    std::cout << " " << *it2; 
    std::cout << std::endl; 
 
    return (0); 
    } 
 
  

要求

数组页眉: <>

命名空间: std

请参见

参考

<array>

array 类 (STL)

array::end

array::front