vec_string_at Subroutine

private pure subroutine vec_string_at(self, index, value, err)

Read element index, 1-based. ERROR_BOUNDS when out of range.

Type Bound

vector_string_t

Arguments

Type IntentOptional Attributes Name
class(vector_string_t), intent(in) :: self
integer(kind=default_int), intent(in) :: index
type(string_type), intent(out) :: value
type(error_t), intent(inout), optional :: err

Calls

proc~~vec_string_at~~CallsGraph proc~vec_string_at vector_string_t%vec_string_at proc~error_raise error_raise proc~vec_string_at->proc~error_raise proc~error_set error_t%error_set proc~error_raise->proc~error_set

Source Code

   pure subroutine vec_string_at(self, index, value, err)
      !! Read element `index`, 1-based. `ERROR_BOUNDS` when out of range.
      class(vector_string_t), intent(in) :: self
      integer(default_int), intent(in) :: index
      type(string_type), intent(out) :: value
      type(error_t), intent(inout), optional :: err

      if (index < 1 .or. index > self%n_items) then
         call error_raise(err, ERROR_BOUNDS, "vector_string_t: at() index is out of range.")
         return
      end if

      value = self%items(index)
   end subroutine vec_string_at