stack_int Derived Type

type, public :: stack_int

堆栈


Contents

Source Code


Components

Type Visibility Attributes Name Initial
integer, public :: len = 0

number of nodes in the stack_int


Type-Bound Procedures

procedure, public, :: push => stack_int_push

  • private pure subroutine stack_int_push(self, item)

    push an item to the stack_int

    Arguments

    Type IntentOptional Attributes Name
    class(stack_int), intent(inout) :: self
    integer, intent(in) :: item

procedure, public, :: pop => stack_int_pop

  • private pure subroutine stack_int_pop(self, item)

    pop an item from the stack_int

    Arguments

    Type IntentOptional Attributes Name
    class(stack_int), intent(inout) :: self
    integer, intent(out), optional :: item

procedure, public, :: iterator

  • private function iterator(self) result(iter)

    Get an stack_int_iterator for the stack_int

    Arguments

    Type IntentOptional Attributes Name
    class(stack_int), intent(in) :: self

    Return Value type(stack_int_iterator)

procedure, public, :: clear => stack_int_clear

  • private pure subroutine stack_int_clear(self)

    Clear the stack_int

    Arguments

    Type IntentOptional Attributes Name
    class(stack_int), intent(inout) :: self

Source Code

    type stack_int
        private
        integer, public :: len = 0 !! number of nodes in the stack_int
        type(node), pointer :: head => null() !! head of the stack_int
        type(node), pointer :: tail => null() !! tail of the stack_int
    contains
        procedure :: push => stack_int_push
        procedure :: pop => stack_int_pop
        procedure :: iterator
        procedure :: clear => stack_int_clear
    end type stack_int