[Cs3] there is still no way to do a pointer in a range-based for

Mikhail Nesterenko mikhail at cs.kent.edu
Thu Feb 3 13:37:55 EST 2022


Even as high as C++23. That is, the below is illegal

     for(auto *p: v) ....


Also, range-based for does not work on dynamic arrays. That is, the
below is also illegal.

      int *a = new int[20];
      for(auto e: a) ...
 
There is a way to do it in C++20 but it is not pretty.

Thanks,
--
Mikhail


More information about the cs3 mailing list