New iterator factory methods to support Fortran looping
Added
-
Added Fortran-friendly iterator factories (and tests) to
ftn_begin()
andftn_end()
have been added to vector, set, map,
and ordered_map templates.ftn_begin()
points to just-before the
1st element of a container, whileftn_end()
points to the last
element. This allows thenext()
invocation to be at the start of the loop which
is less error prone in the presence ofCYCLE
statements. Example usage:type(Vector) :: v type(VectorIterator) :: iter ... associate (e => v%ftn_end()) iter = v%ftn_begin() do while (iter /= e) call iter%next() ... if (<cond>) cycle ! does the right thing ... end do end associate