首页 > 代码库 > 数组迭代器

数组迭代器

#include <iostream>
#include <iterator>

int main()
{
    int array[10] = {0,1,2,3,4,5,-6,-7,8,9};
    int* pbeg = std::begin(array) , *pend = std::end(array);
    while(pbeg != pend && *pbeg >=0)
    {
        std::cout<<*pbeg<<std::endl;
        ++pbeg ;
    }
}

 

技术分享

 

数组迭代器