Range-based for loop on a dynamic array?

后端 未结 6 1072
暖寄归人
暖寄归人 2020-11-29 07:32

There is a range-based for loop with the syntax:

for(auto& i : array)

It works with constant arrays but not with pointer based dynamic

6条回答
  •  孤独总比滥情好
    2020-11-29 08:11

    See this page http://www.codeproject.com/Articles/570638/Ten-Cplusplus11-Features-Every-Cplusplus-Developer and find the chapter "non-member begin() and end()". This could be what you want to achieve.

提交回复
热议问题