C++使用foreach any_of all_off none_of

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/how0723/article/details/80934487
#include <iostream>
#include <algorithm>
int main()
{
    int intArr[] = { 1, 2, 3, 4, 5 };
    std::cout << "std::for_each ......" << std::endl;
    std::for_each(std::begin(intArr), std::end(intArr),
        [](int i)->void{ std::cout << i << std::endl; });
    std::cout << "for(const auto& i : intArr) ......" << std::endl;
    for(const auto& i : intArr)
        std::cout << i << std::endl;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/how0723/article/details/80934487