array_extend Subroutine

private subroutine array_extend(this, items)

Arguments

Type IntentOptional AttributesName
class(ordered), intent(inout) :: this
class(*), intent(in), dimension(:):: items

The items to be added to this data structure

Description

Adds the elements of an array to this object.


Variables

TypeVisibility AttributesNameInitial
integer, public :: i

Source Code

  subroutine array_extend(this, items)
    !* Author: Chris MacMackin
    !  Date: February 2016
    !
    ! Adds the elements of an array to this object.
    ! @Bug `gfortran` does not yet support dimension(*) for unlimited 
    ! polymorphic variables, so I have had to switch to using 
    ! `dimension(:)` when compiling with it. This means that only
    ! 1D arrays are accepted with `gfortran`.
    !
    class(ordered), intent(inout) :: this
#ifdef __GFORTRAN__
    class(*), dimension(:), intent(in) :: items
#else
    class(*), dimension(*), intent(in) :: items
#endif
      !! The items to be added to this data structure
    integer :: i
    do i = 1, size(items)
      call this%push(items(i))
    end do
  end subroutine array_extend