array_list_slice Function

private function array_list_slice(this, start_element, end_element)

Arguments

Type IntentOptional AttributesName
class(array_list), intent(in) :: this
integer, intent(in) :: start_element

The index of the first element in the slice to be returned

integer, intent(in) :: end_element

The index of the last element in the slice to be returned

Return Value class(list), allocatable

An array_list containing the elements within the slice.

Description

Returns an array_list instance containing all items in this list within the specified slice, inclusive. Crashes if one of the indices is outside of the list's bounds.


Source Code

  function array_list_slice(this, start_element, end_element)
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! Returns an [[array_list]] instance containing all items in this
    ! list within the specified slice, inclusive. Crashes if one of
    ! the indices is outside of the list's bounds.
    !
    class(array_list), intent(in) :: this
    integer, intent(in) :: start_element
      !! The index of the first element in the slice to be returned
    integer, intent(in) :: end_element
      !! The index of the last element in the slice to be returned
    class(list), allocatable :: array_list_slice
      !! An array_list containing the elements within the slice.
  end function array_list_slice