vec_string_set Subroutine

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

Overwrite element index, 1-based. ERROR_BOUNDS when out of range; this never extends the vector, use push_back or resize for that.

Type Bound

vector_string_t

Arguments

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

Calls

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

Source Code

   pure subroutine vec_string_set(self, index, value, err)
      !! Overwrite element `index`, 1-based. `ERROR_BOUNDS` when out of range;
      !! this never extends the vector, use `push_back` or `resize` for that.
      class(vector_string_t), intent(inout) :: self
      integer(default_int), intent(in) :: index
      type(string_type), intent(in) :: 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: set() index is out of range.")
         return
      end if

      self%items(index) = value
   end subroutine vec_string_set