iterator_extend Subroutine

private subroutine iterator_extend(this, items)

Arguments

Type IntentOptional AttributesName
class(ordered), intent(inout) :: this
class(iterable), intent(inout) :: items

The iterable whose contents are to be added to this data structure.

Description

Adds the contents of an iterable object to this data structure.


Variables

TypeVisibility AttributesNameInitial
type(iterator), public :: iter_items

Source Code

  subroutine iterator_extend(this, items)
    !* Author: Chris MacMackin
    !  Date: February 2016
    !
    ! Adds the contents of an [[iterable]] object to this data structure.
    !
    class(ordered), intent(inout) :: this
    class(iterable), intent(inout) :: items
      !! The iterable whose contents are to be added to this data
      !! structure.
    type(iterator) :: iter_items
    iter_items = items%iter()
    do while (iter_items%has_next())
      call this%push(iter_items%next())
    end do
  end subroutine iterator_extend