contents_type Function

private pure function contents_type(this)

Arguments

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

Return Value class(container), pointer

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.

Description

Returns a container with the dynamic type of that used to hold the contents of this iterator


Source Code

  pure function contents_type(this)
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! Returns a container with the dynamic type of that used to hold
    ! the contents of this iterator
    !
    class(iterator), intent(in) :: this
    class(container), pointer :: contents_type
      !! 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.
    if (.not. this%filled) return
    allocate(contents_type,mold=this%contents(1))
  end function contents_type