A data type which provides a collection of data to the user. Objects
 of this type are returned using the iter method of
 FIAT's other data types. The contents of the iterator are set to be
 the same as the iterable at the time when the iter method was 
 called. If new items are later added to the iterable object, this
 will not be reflected in the iterator object.
If list_obj is some sort of list which contains character
 strings, then the following would print all strings held in the
 list.
iterator_obj = list_obj%iter() do while(iterator_obj%has_next()) string = iterator_obj%next() write(*,*) string end do
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| class(container), | private, | allocatable, dimension(:) | :: | contents | |||
| integer, | private | :: | location | = | 1 | ||
| logical, | private | :: | filled | = | .false. | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(container), | intent(in), | dimension(:) | :: | contents | 
Creates an iterator from an array of containers containing the data to be returned upon iteration. The data is returned starting with the first element of the array and ending with the last.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(iterator), | intent(in) | :: | this | 
Whether there are additional items to iterate through
Returns .true. if there are any remaining objects through which
 to iterate, and .false. otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(iterator), | intent(inout) | :: | this | 
The next item held in the iterator, if present. Otherwise an unallocated container.
Returns the next item stored in the iterator. If there are no more items present then an empty container is returned. If there are no contents stored in this iterator then it returns an unallocated container.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(iterator), | intent(in) | :: | this | 
A container with the dynamic type of that used to hold the contents of the iterator. It is a pointer as pointer assignment is the easiest way to hold its "value" in an abstract variable.
Returns a container with the dynamic type of that used to hold the contents of this iterator
  type, public :: iterator
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! A data type which provides a collection of data to the user. Objects
    ! of this type are returned using the [[iterable:iter]] method of
    ! FIAT's other data types. The contents of the iterator are set to be
    ! the same as the iterable at the time when the `iter` method was 
    ! called. If new items are later added to the iterable object, this
    ! will not be reflected in the iterator object.
    !
    !##Example
    ! If `list_obj` is some sort of [[list]] which contains character
    ! strings, then the following would print all strings held in the
    ! list.
    !```fortran
    !iterator_obj = list_obj%iter()
    !do while(iterator_obj%has_next())
    !    string = iterator_obj%next()
    !    write(*,*) string
    !end do
    !```
    !
    private
    class(container), allocatable, dimension(:) :: contents
    integer :: location = 1
    logical :: filled = .false.
  contains
    procedure :: has_next
    procedure :: next
    procedure :: reset
    procedure :: contents_type
  end type iterator