📜  c++ array interator - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:54.724000             🧑  作者: Mango

代码示例1
#include 
#include 

#include 

int main()
{
    int c_array[5] = {};
    std::array cpp_array = {};
    std::vector cpp_dynarray(5);

    auto c_array_begin = std::begin(c_array); // = c_array + 0
    auto c_array_end = std::end(c_array);     // = c_array + 5

    auto cpp_array_begin = std::begin(cpp_array); // = cpp_array.begin()
    auto cpp_array_end = std::end(cpp_array);     // = cpp_array.end()

    auto cpp_dynarray_begin = std::begin(cpp_dynarray); // = cpp_dynarray.begin()
    auto cpp_dynarray_end = std::end(cpp_dynarray);     // = cpp_dynarray.end()
}