has_next Function

private elemental function has_next(this)

Arguments

Type IntentOptional AttributesName
class(iterator), intent(in) :: this

Return Value logical

Whether there are additional items to iterate through

Description

Returns .true. if there are any remaining objects through which to iterate, and .false. otherwise.


Source Code

  elemental function has_next(this)
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! Returns `.true.` if there are any remaining objects through which
    ! to iterate, and `.false.` otherwise.
    !
    class(iterator), intent(in) :: this
    logical :: has_next
      !! Whether there are additional items to iterate through
    has_next = this%location <= size(this%contents)
  end function has_next