c++对普通数组执行序列

标签 c++

<分区>

基于sequence.begin()/end()/++的c++ sequence-for,但是普通数组如int a[10];可以也执行此操作。为什么?是否存在从普通数组到 std::array 的隐式转换?

最佳答案

对于普通数组 range-for使用特殊处理:

If range_expression is an expression of array type, then begin_expr is __range and end_expr is (__range + __bound), where __bound is the number of elements in the array (if the array has unknown size or is of an incomplete type, the program is ill-formed)

关于c++对普通数组执行序列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52514842/

相关文章:

c++ - LInux/c++,如何同时保护两个数据结构?

c++ - 在 Irrlicht 中使用 SDL

c++ - 包含相同类型的结构指针的结构指针的初始化

c++ - 通过查看程序集比较按值传递与按引用传递的性能

c++ - 我可以将参数传递给 std::vector 排序函数吗?

c++ - 有没有办法在 Visual Studio 中列出库依赖项?

c++ - 如何将MAC地址转换为对应的IP地址?

c++ - Boost::HPC 侵入式

c++ - 如何使用 c++/python 程序在终端中运行程序,然后在该程序中执行语句

c++ - 新版本的c++