[Cs3] range-based for with iterators and compiler version

Mikhail Nesterenko mikhail at cs.kent.edu
Tue Feb 9 15:08:14 EST 2021


CS3 students,

range-based for loops like

   for(auto *it: container)

are not allowed in any of the standards. If you need an iterator, you
need to write an honest for-loop. There is a rather long way of
implementing this feature described in stackoverflow

   https://stackoverflow.com/questions/6953128/need-iterator-when-using-ranged-based-for-loops

Meanwhile, the g++ compiler on wasp/hornet/poseidon/neptune is version
8.3+ and supports the C++ standard C++17 and most features of C++20.

Thanks,
-- 
Mikhail


More information about the cs3 mailing list